core: use blocks and avoid deep reorgs in txpool

This commit is contained in:
Péter Szilágyi
2017-09-05 19:49:37 +03:00
parent 03d00361f5
commit cc313e78b7
2 changed files with 56 additions and 46 deletions

View File

@ -50,24 +50,24 @@ type testBlockChain struct {
chainHeadFeed *event.Feed
}
func (bc *testBlockChain) CurrentHeader() *types.Header {
return &types.Header{
func (bc *testBlockChain) CurrentBlock() *types.Block {
return types.NewBlock(&types.Header{
GasLimit: bc.gasLimit,
}
}
func (bc *testBlockChain) SubscribeChainHeadEvent(ch chan<- ChainHeadEvent) event.Subscription {
return bc.chainHeadFeed.Subscribe(ch)
}, nil, nil, nil)
}
func (bc *testBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block {
return types.NewBlock(bc.CurrentHeader(), nil, nil, nil)
return bc.CurrentBlock()
}
func (bc *testBlockChain) StateAt(common.Hash) (*state.StateDB, error) {
return bc.statedb, nil
}
func (bc *testBlockChain) SubscribeChainHeadEvent(ch chan<- ChainHeadEvent) event.Subscription {
return bc.chainHeadFeed.Subscribe(ch)
}
func transaction(nonce uint64, gaslimit *big.Int, key *ecdsa.PrivateKey) *types.Transaction {
return pricedTransaction(nonce, gaslimit, big.NewInt(1), key)
}