Skip to content

Commit 2d09e67

Browse files
committed
Updated to new methods
1 parent 49e0267 commit 2d09e67

File tree

8 files changed

+16
-9
lines changed

8 files changed

+16
-9
lines changed

block_pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (self *BlockPool) HasLatestHash() bool {
6666
self.mut.Lock()
6767
defer self.mut.Unlock()
6868

69-
return self.pool[string(self.eth.ChainManager().CurrentBlock.Hash())] != nil
69+
return self.pool[string(self.eth.ChainManager().CurrentBlock().Hash())] != nil
7070
}
7171

7272
func (self *BlockPool) HasCommonHash(hash []byte) bool {

cmd/ethereum/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func main() {
7777
var block *types.Block
7878

7979
if len(DumpHash) == 0 && DumpNumber == -1 {
80-
block = ethereum.ChainManager().CurrentBlock
80+
block = ethereum.ChainManager().CurrentBlock()
8181
} else if len(DumpHash) > 0 {
8282
block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash))
8383
} else {

cmd/mist/debugger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
149149

150150
self.SetAsm(script)
151151

152-
block := self.lib.eth.ChainManager().CurrentBlock
152+
block := self.lib.eth.ChainManager().CurrentBlock()
153153

154154
env := utils.NewEnv(statedb, block, account.Address(), value)
155155

cmd/mist/gui.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) {
246246
}
247247

248248
func (gui *Gui) setInitialChain(ancientBlocks bool) {
249-
sBlk := gui.eth.ChainManager().LastBlockHash
249+
sBlk := gui.eth.ChainManager().LastBlockHash()
250250
blk := gui.eth.ChainManager().GetBlock(sBlk)
251251
for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) {
252252
sBlk = blk.PrevHash
@@ -468,7 +468,7 @@ func (gui *Gui) update() {
468468
case <-peerUpdateTicker.C:
469469
gui.setPeerInfo()
470470
case <-generalUpdateTicker.C:
471-
statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String()
471+
statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number.String()
472472
lastBlockLabel.Set("text", statusText)
473473
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash")
474474

core/chain_manager.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ func (self *ChainManager) LastBlockNumber() uint64 {
7474
return self.lastBlockNumber
7575
}
7676

77+
func (self *ChainManager) LastBlockHash() []byte {
78+
self.mu.RLock()
79+
defer self.mu.RUnlock()
80+
81+
return self.lastBlockHash
82+
}
83+
7784
func (self *ChainManager) CurrentBlock() *types.Block {
7885
self.mu.RLock()
7986
defer self.mu.RUnlock()

peer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ func (self *Peer) pushStatus() {
666666
msg := wire.NewMessage(wire.MsgStatusTy, []interface{}{
667667
uint32(ProtocolVersion),
668668
uint32(NetVersion),
669-
self.ethereum.ChainManager().TD,
670-
self.ethereum.ChainManager().CurrentBlock.Hash(),
669+
self.ethereum.ChainManager().Td(),
670+
self.ethereum.ChainManager().CurrentBlock().Hash(),
671671
self.ethereum.ChainManager().Genesis().Hash(),
672672
})
673673

xeth/hexface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (self *JSXEth) BlockByHash(strHash string) *JSBlock {
2929

3030
func (self *JSXEth) BlockByNumber(num int32) *JSBlock {
3131
if num == -1 {
32-
return NewJSBlock(self.obj.ChainManager().CurrentBlock)
32+
return NewJSBlock(self.obj.ChainManager().CurrentBlock())
3333
}
3434

3535
return NewJSBlock(self.obj.ChainManager().GetBlockByNumber(uint64(num)))

xeth/pipe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (self *XEth) Execute(addr []byte, data []byte, value, gas, price *ethutil.V
8282
func (self *XEth) ExecuteObject(object *Object, data []byte, value, gas, price *ethutil.Value) ([]byte, error) {
8383
var (
8484
initiator = state.NewStateObject(self.obj.KeyManager().KeyPair().Address())
85-
block = self.chainManager.CurrentBlock
85+
block = self.chainManager.CurrentBlock()
8686
)
8787

8888
self.Vm.State = self.World().State().Copy()

0 commit comments

Comments
 (0)