aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/block_chain.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-26 19:32:54 +0800
committerobscuren <geffobscura@gmail.com>2014-09-26 19:32:54 +0800
commit68119d0929adebdbd39dd40982264f86164bd6e6 (patch)
tree4da88788275c960f3b82581c7f5e24b72c097130 /ethchain/block_chain.go
parent9ed8dc7384deb932be624699d9f628d3d00ba31e (diff)
downloaddexon-68119d0929adebdbd39dd40982264f86164bd6e6.tar.gz
dexon-68119d0929adebdbd39dd40982264f86164bd6e6.tar.zst
dexon-68119d0929adebdbd39dd40982264f86164bd6e6.zip
Fixed messages to use proper numbers
Diffstat (limited to 'ethchain/block_chain.go')
-rw-r--r--ethchain/block_chain.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/ethchain/block_chain.go b/ethchain/block_chain.go
index c8e5c610e..467c54058 100644
--- a/ethchain/block_chain.go
+++ b/ethchain/block_chain.go
@@ -236,6 +236,16 @@ func (self *BlockChain) GetBlockByNumber(num uint64) *Block {
return block
}
+func (self *BlockChain) GetBlockBack(num uint64) *Block {
+ block := self.CurrentBlock
+
+ for ; num != 0 && block != nil; num-- {
+ block = self.GetBlock(block.PrevHash)
+ }
+
+ return block
+}
+
func (bc *BlockChain) BlockInfoByHash(hash []byte) BlockInfo {
bi := BlockInfo{}
data, _ := ethutil.Config.Db.Get(append(hash, []byte("Info")...))