good morning!!!!

Skip to content
Snippets Groups Projects
Commit ce239333 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Update balance label when mining

parent 0f3c25b2
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,17 @@ Rectangle {
objectName: "walletView"
anchors.fill: parent
Label {
objectName: "balanceLabel"
visible: false
font.pixelSize: 10
anchors.right: lastBlockLabel.left
anchors.rightMargin: 5
onTextChanged: {
menuItem.secondaryTitle = text
}
}
function onReady() {
setBalance()
}
......
......@@ -412,7 +412,9 @@ func (gui *Gui) update() {
switch ev := ev.(type) {
case core.NewBlockEvent:
gui.processBlock(ev.Block, false)
gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil)
//gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil)
balance := ethutil.CurrencyToString(gui.eth.ChainManager().State().GetBalance(gui.address()))
gui.getObjectByName("balanceLabel").Set("text", fmt.Sprintf("%v", balance))
case core.TxPreEvent:
tx := ev.Tx
......
......@@ -6,6 +6,7 @@ import (
"math/big"
"sort"
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/rlp"
......@@ -175,6 +176,7 @@ func (self *Block) RlpDataForStorage() interface{} {
// Header accessors (add as you need them)
func (self *Block) Number() *big.Int { return self.header.Number }
func (self *Block) NumberU64() uint64 { return self.header.Number.Uint64() }
func (self *Block) Nonce() []byte { return self.header.Nonce }
func (self *Block) Bloom() []byte { return self.header.Bloom }
func (self *Block) Coinbase() []byte { return self.header.Coinbase }
func (self *Block) Time() int64 { return int64(self.header.Time) }
......
......@@ -127,7 +127,8 @@ out:
func (self *worker) wait() {
for {
for work := range self.recv {
if self.current.block.Number().Uint64() == work.Number {
block := self.current.block
if block.Number().Uint64() == work.Number && block.Nonce() == nil {
self.current.block.Header().Nonce = work.Nonce
self.chain.InsertChain(types.Blocks{self.current.block})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment