Merge pull request #40 from bas-vk/quorum-txpool-pending-state

core: init pending state in tx pool on creation
This commit is contained in:
Samer Falah 2017-01-17 11:50:06 -05:00 committed by GitHub
commit b9adeeb963
1 changed files with 2 additions and 4 deletions

View File

@ -100,6 +100,8 @@ func NewTxPool(config *ChainConfig, eventMux *event.TypeMux, currentStateFn stat
quit: make(chan struct{}),
}
pool.resetState()
pool.wg.Add(2)
go pool.eventLoop()
go pool.expirationLoop()
@ -348,10 +350,6 @@ func (pool *TxPool) enqueueTx(hash common.Hash, tx *types.Transaction) {
//
// Note, this method assumes the pool lock is held!
func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.Transaction) {
// Init delayed since tx pool could have been started before any state sync
if pool.pendingState == nil {
pool.resetState()
}
// Try to insert the transaction into the pending queue
if pool.pending[addr] == nil {
pool.pending[addr] = newTxList(true)