mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2025-01-12 21:50:04 +00:00
core: don't remove transactions after block processing
The transaction pool drops processed transactions on its own during pool maintenance.
This commit is contained in:
parent
5721c43585
commit
ec7a2c3442
@ -38,14 +38,12 @@ type BlockProcessor struct {
|
|||||||
// Proof of work used for validating
|
// Proof of work used for validating
|
||||||
Pow pow.PoW
|
Pow pow.PoW
|
||||||
|
|
||||||
txpool *TxPool
|
|
||||||
|
|
||||||
events event.Subscription
|
events event.Subscription
|
||||||
|
|
||||||
eventMux *event.TypeMux
|
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{
|
sm := &BlockProcessor{
|
||||||
db: db,
|
db: db,
|
||||||
extraDb: extra,
|
extraDb: extra,
|
||||||
@ -53,7 +51,6 @@ func NewBlockProcessor(db, extra common.Database, pow pow.PoW, txpool *TxPool, c
|
|||||||
Pow: pow,
|
Pow: pow,
|
||||||
bc: chainManager,
|
bc: chainManager,
|
||||||
eventMux: eventMux,
|
eventMux: eventMux,
|
||||||
txpool: txpool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sm
|
return sm
|
||||||
|
@ -17,7 +17,7 @@ func proc() (*BlockProcessor, *ChainManager) {
|
|||||||
var mux event.TypeMux
|
var mux event.TypeMux
|
||||||
|
|
||||||
chainMan := NewChainManager(db, db, thePow(), &mux)
|
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) {
|
func TestNumber(t *testing.T) {
|
||||||
|
@ -124,8 +124,7 @@ func newChainManager(block *types.Block, eventMux *event.TypeMux, db common.Data
|
|||||||
// block processor with fake pow
|
// block processor with fake pow
|
||||||
func newBlockProcessor(db common.Database, cman *ChainManager, eventMux *event.TypeMux) *BlockProcessor {
|
func newBlockProcessor(db common.Database, cman *ChainManager, eventMux *event.TypeMux) *BlockProcessor {
|
||||||
chainMan := newChainManager(nil, eventMux, db)
|
chainMan := newChainManager(nil, eventMux, db)
|
||||||
txpool := NewTxPool(eventMux, chainMan.State, chainMan.GasLimit)
|
bman := NewBlockProcessor(db, db, FakePow{}, chainMan, eventMux)
|
||||||
bman := NewBlockProcessor(db, db, FakePow{}, txpool, chainMan, eventMux)
|
|
||||||
return bman
|
return bman
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,8 +267,7 @@ func TestChainInsertions(t *testing.T) {
|
|||||||
|
|
||||||
var eventMux event.TypeMux
|
var eventMux event.TypeMux
|
||||||
chainMan := NewChainManager(db, db, thePow(), &eventMux)
|
chainMan := NewChainManager(db, db, thePow(), &eventMux)
|
||||||
txPool := NewTxPool(&eventMux, chainMan.State, func() *big.Int { return big.NewInt(100000000) })
|
blockMan := NewBlockProcessor(db, db, nil, chainMan, &eventMux)
|
||||||
blockMan := NewBlockProcessor(db, db, nil, txPool, chainMan, &eventMux)
|
|
||||||
chainMan.SetProcessor(blockMan)
|
chainMan.SetProcessor(blockMan)
|
||||||
|
|
||||||
const max = 2
|
const max = 2
|
||||||
@ -313,8 +312,7 @@ func TestChainMultipleInsertions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
var eventMux event.TypeMux
|
var eventMux event.TypeMux
|
||||||
chainMan := NewChainManager(db, db, thePow(), &eventMux)
|
chainMan := NewChainManager(db, db, thePow(), &eventMux)
|
||||||
txPool := NewTxPool(&eventMux, chainMan.State, func() *big.Int { return big.NewInt(100000000) })
|
blockMan := NewBlockProcessor(db, db, nil, chainMan, &eventMux)
|
||||||
blockMan := NewBlockProcessor(db, db, nil, txPool, chainMan, &eventMux)
|
|
||||||
chainMan.SetProcessor(blockMan)
|
chainMan.SetProcessor(blockMan)
|
||||||
done := make(chan bool, max)
|
done := make(chan bool, max)
|
||||||
for i, chain := range chains {
|
for i, chain := range chains {
|
||||||
|
Loading…
Reference in New Issue
Block a user