diff options
author | zelig <viktor.tron@gmail.com> | 2014-12-15 02:20:37 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-12-15 04:30:56 +0800 |
commit | d84810d89df128d9120a4562bb9e6334ba6a33d4 (patch) | |
tree | 50240c8c8c87df962d24a2247864cdcf75ca464c | |
parent | 39d86a28e7d27bf1f6a2e2e298b52614ee0b9be3 (diff) | |
download | dexon-d84810d89df128d9120a4562bb9e6334ba6a33d4.tar dexon-d84810d89df128d9120a4562bb9e6334ba6a33d4.tar.gz dexon-d84810d89df128d9120a4562bb9e6334ba6a33d4.tar.bz2 dexon-d84810d89df128d9120a4562bb9e6334ba6a33d4.tar.lz dexon-d84810d89df128d9120a4562bb9e6334ba6a33d4.tar.xz dexon-d84810d89df128d9120a4562bb9e6334ba6a33d4.tar.zst dexon-d84810d89df128d9120a4562bb9e6334ba6a33d4.zip |
add Status to retrieve TD, currentBlock, genesis for easy interface with eth/protocol
-rw-r--r-- | core/chain_manager.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index edf50e715..f9fb3b3f8 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -72,6 +72,10 @@ func NewChainManager(mux *event.TypeMux) *ChainManager { return bc } +func (self *ChainManager) Status() (td *big.Int, currentBlock []byte, genesisBlock []byte) { + return self.TD, self.CurrentBlock.Hash(), self.Genesis().Hash() +} + func (self *ChainManager) SetProcessor(proc types.BlockProcessor) { self.processor = proc } @@ -173,7 +177,7 @@ func (bc *ChainManager) HasBlock(hash []byte) bool { return len(data) != 0 } -func (self *ChainManager) GetChainHashesFromHash(hash []byte, max uint64) (chain [][]byte) { +func (self *ChainManager) GetBlockHashesFromHash(hash []byte, max uint64) (chain [][]byte) { block := self.GetBlock(hash) if block == nil { return |