aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-06-27 19:57:56 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-06-30 00:51:49 +0800
commite349fac97dea92ef77ba5e72599fbe9f0ae16c2a (patch)
treec9995802dd0ca0afeee75c63108e6fc2737dce93
parentaba901e13cc40400b644041044ada13636927f44 (diff)
downloadgo-tangerine-e349fac97dea92ef77ba5e72599fbe9f0ae16c2a.tar
go-tangerine-e349fac97dea92ef77ba5e72599fbe9f0ae16c2a.tar.gz
go-tangerine-e349fac97dea92ef77ba5e72599fbe9f0ae16c2a.tar.bz2
go-tangerine-e349fac97dea92ef77ba5e72599fbe9f0ae16c2a.tar.lz
go-tangerine-e349fac97dea92ef77ba5e72599fbe9f0ae16c2a.tar.xz
go-tangerine-e349fac97dea92ef77ba5e72599fbe9f0ae16c2a.tar.zst
go-tangerine-e349fac97dea92ef77ba5e72599fbe9f0ae16c2a.zip
core: fixed tests
-rw-r--r--core/chain_makers_test.go2
-rw-r--r--core/chain_manager.go1
-rw-r--r--core/chain_manager_test.go1
3 files changed, 2 insertions, 2 deletions
diff --git a/core/chain_makers_test.go b/core/chain_makers_test.go
index 8e821fc4a..d5125e1c3 100644
--- a/core/chain_makers_test.go
+++ b/core/chain_makers_test.go
@@ -60,7 +60,7 @@ func ExampleGenerateChain() {
evmux := &event.TypeMux{}
chainman, _ := NewChainManager(genesis, db, db, FakePow{}, evmux)
chainman.SetProcessor(NewBlockProcessor(db, db, FakePow{}, chainman, evmux))
- if i, err := chainman.InsertChain(chain[1:]); err != nil {
+ if i, err := chainman.InsertChain(chain); err != nil {
fmt.Printf("insert error (block %d): %v\n", i, err)
return
}
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 85c1e39d7..a4c8563c3 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -264,6 +264,7 @@ func (bc *ChainManager) setLastState() {
func (bc *ChainManager) makeCache() {
bc.cache, _ = lru.New(blockCacheLimit)
// load in last `blockCacheLimit` - 1 blocks. Last block is the current.
+ bc.cache.Add(bc.genesisBlock.Hash(), bc.genesisBlock)
for _, block := range bc.GetBlocksFromHash(bc.currentBlock.Hash(), blockCacheLimit) {
bc.cache.Add(block.Hash(), block)
}
diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go
index 70130c02c..11a326ae4 100644
--- a/core/chain_manager_test.go
+++ b/core/chain_manager_test.go
@@ -63,7 +63,6 @@ func testFork(t *testing.T, bman *BlockProcessor, i, N int, f func(td1, td2 *big
if bi1 != bi2 {
t.Fatal("chains do not have the same hash at height", i)
}
-
bman2.bc.SetProcessor(bman2)
// extend the fork