From ec7a2c34423f9337c238ff07c39a15eb18eed79a Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 3 Jun 2015 15:52:25 +0200 Subject: [PATCH] core: don't remove transactions after block processing The transaction pool drops processed transactions on its own during pool maintenance. --- core/block_processor.go | 5 +---- core/block_processor_test.go | 2 +- core/chain_makers.go | 3 +-- core/chain_manager_test.go | 6 ++---- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/core/block_processor.go b/core/block_processor.go index 9a013b280..190e72694 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -38,14 +38,12 @@ type BlockProcessor struct { // Proof of work used for validating Pow pow.PoW - txpool *TxPool - events event.Subscription eventMux *event.TypeMux } -func NewBlockProcessor(db, extra common.Database, pow pow.PoW, txpool *TxPool, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor { +func NewBlockProcessor(db, extra common.Database, pow pow.PoW, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor { sm := &BlockProcessor{ db: db, extraDb: extra, @@ -53,7 +51,6 @@ func NewBlockProcessor(db, extra common.Database, pow pow.PoW, txpool *TxPool, c Pow: pow, bc: chainManager, eventMux: eventMux, - txpool: txpool, } return sm diff --git a/core/block_processor_test.go b/core/block_processor_test.go index 72b173a71..b52c3d3f8 100644 --- a/core/block_processor_test.go +++ b/core/block_processor_test.go @@ -17,7 +17,7 @@ func proc() (*BlockProcessor, *ChainManager) { var mux event.TypeMux chainMan := NewChainManager(db, db, thePow(), &mux) - return NewBlockProcessor(db, db, ezp.New(), nil, chainMan, &mux), chainMan + return NewBlockProcessor(db, db, ezp.New(), chainMan, &mux), chainMan } func TestNumber(t *testing.T) { diff --git a/core/chain_makers.go b/core/chain_makers.go index 44f17cc33..3039e52da 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -124,8 +124,7 @@ func newChainManager(block *types.Block, eventMux *event.TypeMux, db common.Data // block processor with fake pow func newBlockProcessor(db common.Database, cman *ChainManager, eventMux *event.TypeMux) *BlockProcessor { chainMan := newChainManager(nil, eventMux, db) - txpool := NewTxPool(eventMux, chainMan.State, chainMan.GasLimit) - bman := NewBlockProcessor(db, db, FakePow{}, txpool, chainMan, eventMux) + bman := NewBlockProcessor(db, db, FakePow{}, chainMan, eventMux) return bman } diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index 7dc7358c0..560e85f77 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -267,8 +267,7 @@ func TestChainInsertions(t *testing.T) { var eventMux event.TypeMux chainMan := NewChainManager(db, db, thePow(), &eventMux) - txPool := NewTxPool(&eventMux, chainMan.State, func() *big.Int { return big.NewInt(100000000) }) - blockMan := NewBlockProcessor(db, db, nil, txPool, chainMan, &eventMux) + blockMan := NewBlockProcessor(db, db, nil, chainMan, &eventMux) chainMan.SetProcessor(blockMan) const max = 2 @@ -313,8 +312,7 @@ func TestChainMultipleInsertions(t *testing.T) { } var eventMux event.TypeMux chainMan := NewChainManager(db, db, thePow(), &eventMux) - txPool := NewTxPool(&eventMux, chainMan.State, func() *big.Int { return big.NewInt(100000000) }) - blockMan := NewBlockProcessor(db, db, nil, txPool, chainMan, &eventMux) + blockMan := NewBlockProcessor(db, db, nil, chainMan, &eventMux) chainMan.SetProcessor(blockMan) done := make(chan bool, max) for i, chain := range chains {