aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block_pool.go2
-rw-r--r--cmd/ethereum/main.go2
-rw-r--r--cmd/mist/debugger.go2
-rw-r--r--cmd/mist/gui.go4
-rw-r--r--core/chain_manager.go7
-rw-r--r--peer.go4
-rw-r--r--xeth/hexface.go2
-rw-r--r--xeth/pipe.go2
8 files changed, 16 insertions, 9 deletions
diff --git a/block_pool.go b/block_pool.go
index 803927f21..c618f6993 100644
--- a/block_pool.go
+++ b/block_pool.go
@@ -66,7 +66,7 @@ func (self *BlockPool) HasLatestHash() bool {
self.mut.Lock()
defer self.mut.Unlock()
- return self.pool[string(self.eth.ChainManager().CurrentBlock.Hash())] != nil
+ return self.pool[string(self.eth.ChainManager().CurrentBlock().Hash())] != nil
}
func (self *BlockPool) HasCommonHash(hash []byte) bool {
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 43551fb3a..9efc8e9dc 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -77,7 +77,7 @@ func main() {
var block *types.Block
if len(DumpHash) == 0 && DumpNumber == -1 {
- block = ethereum.ChainManager().CurrentBlock
+ block = ethereum.ChainManager().CurrentBlock()
} else if len(DumpHash) > 0 {
block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash))
} else {
diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go
index d7c584eab..a7a286e23 100644
--- a/cmd/mist/debugger.go
+++ b/cmd/mist/debugger.go
@@ -149,7 +149,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
self.SetAsm(script)
- block := self.lib.eth.ChainManager().CurrentBlock
+ block := self.lib.eth.ChainManager().CurrentBlock()
env := utils.NewEnv(statedb, block, account.Address(), value)
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index fe066e994..773688ffc 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -246,7 +246,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) {
}
func (gui *Gui) setInitialChain(ancientBlocks bool) {
- sBlk := gui.eth.ChainManager().LastBlockHash
+ sBlk := gui.eth.ChainManager().LastBlockHash()
blk := gui.eth.ChainManager().GetBlock(sBlk)
for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) {
sBlk = blk.PrevHash
@@ -468,7 +468,7 @@ func (gui *Gui) update() {
case <-peerUpdateTicker.C:
gui.setPeerInfo()
case <-generalUpdateTicker.C:
- statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String()
+ statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number.String()
lastBlockLabel.Set("text", statusText)
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash")
diff --git a/core/chain_manager.go b/core/chain_manager.go
index c81552b5d..794ae0011 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -74,6 +74,13 @@ func (self *ChainManager) LastBlockNumber() uint64 {
return self.lastBlockNumber
}
+func (self *ChainManager) LastBlockHash() []byte {
+ self.mu.RLock()
+ defer self.mu.RUnlock()
+
+ return self.lastBlockHash
+}
+
func (self *ChainManager) CurrentBlock() *types.Block {
self.mu.RLock()
defer self.mu.RUnlock()
diff --git a/peer.go b/peer.go
index 331e9de37..13f0239d4 100644
--- a/peer.go
+++ b/peer.go
@@ -666,8 +666,8 @@ func (self *Peer) pushStatus() {
msg := wire.NewMessage(wire.MsgStatusTy, []interface{}{
uint32(ProtocolVersion),
uint32(NetVersion),
- self.ethereum.ChainManager().TD,
- self.ethereum.ChainManager().CurrentBlock.Hash(),
+ self.ethereum.ChainManager().Td(),
+ self.ethereum.ChainManager().CurrentBlock().Hash(),
self.ethereum.ChainManager().Genesis().Hash(),
})
diff --git a/xeth/hexface.go b/xeth/hexface.go
index c1f49453d..75ec5f43d 100644
--- a/xeth/hexface.go
+++ b/xeth/hexface.go
@@ -29,7 +29,7 @@ func (self *JSXEth) BlockByHash(strHash string) *JSBlock {
func (self *JSXEth) BlockByNumber(num int32) *JSBlock {
if num == -1 {
- return NewJSBlock(self.obj.ChainManager().CurrentBlock)
+ return NewJSBlock(self.obj.ChainManager().CurrentBlock())
}
return NewJSBlock(self.obj.ChainManager().GetBlockByNumber(uint64(num)))
diff --git a/xeth/pipe.go b/xeth/pipe.go
index a8d8ed999..1e4d0ec60 100644
--- a/xeth/pipe.go
+++ b/xeth/pipe.go
@@ -82,7 +82,7 @@ func (self *XEth) Execute(addr []byte, data []byte, value, gas, price *ethutil.V
func (self *XEth) ExecuteObject(object *Object, data []byte, value, gas, price *ethutil.Value) ([]byte, error) {
var (
initiator = state.NewStateObject(self.obj.KeyManager().KeyPair().Address())
- block = self.chainManager.CurrentBlock
+ block = self.chainManager.CurrentBlock()
)
self.Vm.State = self.World().State().Copy()