mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-08 09:11:34 +00:00
core: fixed tests
This commit is contained in:
parent
aba901e13c
commit
e349fac97d
3 changed files with 2 additions and 2 deletions
|
|
@ -60,7 +60,7 @@ func ExampleGenerateChain() {
|
||||||
evmux := &event.TypeMux{}
|
evmux := &event.TypeMux{}
|
||||||
chainman, _ := NewChainManager(genesis, db, db, FakePow{}, evmux)
|
chainman, _ := NewChainManager(genesis, db, db, FakePow{}, evmux)
|
||||||
chainman.SetProcessor(NewBlockProcessor(db, db, FakePow{}, chainman, 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)
|
fmt.Printf("insert error (block %d): %v\n", i, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,7 @@ func (bc *ChainManager) setLastState() {
|
||||||
func (bc *ChainManager) makeCache() {
|
func (bc *ChainManager) makeCache() {
|
||||||
bc.cache, _ = lru.New(blockCacheLimit)
|
bc.cache, _ = lru.New(blockCacheLimit)
|
||||||
// load in last `blockCacheLimit` - 1 blocks. Last block is the current.
|
// 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) {
|
for _, block := range bc.GetBlocksFromHash(bc.currentBlock.Hash(), blockCacheLimit) {
|
||||||
bc.cache.Add(block.Hash(), block)
|
bc.cache.Add(block.Hash(), block)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ func testFork(t *testing.T, bman *BlockProcessor, i, N int, f func(td1, td2 *big
|
||||||
if bi1 != bi2 {
|
if bi1 != bi2 {
|
||||||
t.Fatal("chains do not have the same hash at height", i)
|
t.Fatal("chains do not have the same hash at height", i)
|
||||||
}
|
}
|
||||||
|
|
||||||
bman2.bc.SetProcessor(bman2)
|
bman2.bc.SetProcessor(bman2)
|
||||||
|
|
||||||
// extend the fork
|
// extend the fork
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue