aboutsummaryrefslogtreecommitdiffstats
path: root/core/chain_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-10 00:38:35 +0800
committerobscuren <geffobscura@gmail.com>2015-01-10 00:38:35 +0800
commit905b8cc82f3dc29131f45ccf29bd1d6c967fe132 (patch)
tree61f251d788868263cdd93aeb7c19b8ea3f3e0be4 /core/chain_manager.go
parent35f4bb96f313f4f04e70d1cf135be3a4759a8179 (diff)
downloadgo-tangerine-905b8cc82f3dc29131f45ccf29bd1d6c967fe132.tar.gz
go-tangerine-905b8cc82f3dc29131f45ccf29bd1d6c967fe132.tar.zst
go-tangerine-905b8cc82f3dc29131f45ccf29bd1d6c967fe132.zip
mem fixes for vm. Changed uncle inclusion tests
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r--core/chain_manager.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 3e0a3fb23..90b5692ac 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -262,6 +262,28 @@ func (self *ChainManager) GetBlock(hash []byte) *types.Block {
return &block
}
+func (self *ChainManager) GetUnclesInChain(block *types.Block, length int) (uncles []*types.Header) {
+ for i := 0; block != nil && i < length; i++ {
+ uncles = append(uncles, block.Uncles()...)
+ block = self.GetBlock(block.ParentHash())
+ }
+
+ return
+}
+
+func (self *ChainManager) GetAncestors(block *types.Block, length int) (blocks []*types.Block) {
+ for i := 0; i < length; i++ {
+ block = self.GetBlock(block.ParentHash())
+ if block == nil {
+ break
+ }
+
+ blocks = append(blocks, block)
+ }
+
+ return
+}
+
func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block {
self.mu.RLock()
defer self.mu.RUnlock()