Update balance label when mining
This commit is contained in:
parent
0f3c25b265
commit
ce239333d5
@ -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})
|
||||
|
Loading…
Reference in New Issue
Block a user