aboutsummaryrefslogtreecommitdiffstats
path: root/light/txpool.go
diff options
context:
space:
mode:
Diffstat (limited to 'light/txpool.go')
-rw-r--r--light/txpool.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/light/txpool.go b/light/txpool.go
index 5b4d06d90..767a797bd 100644
--- a/light/txpool.go
+++ b/light/txpool.go
@@ -199,15 +199,17 @@ func (pool *TxPool) checkMinedTxs(ctx context.Context, hash common.Hash, number
// rollbackTxs marks the transactions contained in recently rolled back blocks
// as rolled back. It also removes any positional lookup entries.
func (pool *TxPool) rollbackTxs(hash common.Hash, txc txStateChanges) {
+ batch := pool.chainDb.NewBatch()
if list, ok := pool.mined[hash]; ok {
for _, tx := range list {
txHash := tx.Hash()
- rawdb.DeleteTxLookupEntry(pool.chainDb, txHash)
+ rawdb.DeleteTxLookupEntry(batch, txHash)
pool.pending[txHash] = tx
txc.setState(txHash, false)
}
delete(pool.mined, hash)
}
+ batch.Write()
}
// reorgOnNewHead sets a new head header, processing (and rolling back if necessary)
@@ -504,14 +506,16 @@ func (self *TxPool) Content() (map[common.Address]types.Transactions, map[common
func (self *TxPool) RemoveTransactions(txs types.Transactions) {
self.mu.Lock()
defer self.mu.Unlock()
+
var hashes []common.Hash
+ batch := self.chainDb.NewBatch()
for _, tx := range txs {
- //self.RemoveTx(tx.Hash())
hash := tx.Hash()
delete(self.pending, hash)
- self.chainDb.Delete(hash[:])
+ batch.Delete(hash.Bytes())
hashes = append(hashes, hash)
}
+ batch.Write()
self.relay.Discard(hashes)
}