core/rawdb: single point of maintenance for writing and deleting tx lookup indexes (#21480)

This commit is contained in:
Giuseppe Bertone
2020-09-15 10:37:01 +02:00
committed by GitHub
parent 4764b2f0be
commit 0185ee0993
5 changed files with 31 additions and 29 deletions

View File

@ -218,7 +218,7 @@ func IndexTransactions(db ethdb.Database, from uint64, to uint64) {
// Next block available, pop it off and index it
delivery := queue.PopItem().(*blockTxHashes)
lastNum = delivery.number
WriteTxLookupEntriesByHash(batch, delivery.number, delivery.hashes)
WriteTxLookupEntries(batch, delivery.number, delivery.hashes)
blocks++
txs += len(delivery.hashes)
// If enough data was accumulated in memory or we're at the last block, dump to disk
@ -276,7 +276,7 @@ func UnindexTransactions(db ethdb.Database, from uint64, to uint64) {
// Otherwise spin up the concurrent iterator and unindexer
blocks, txs := 0, 0
for delivery := range hashesCh {
DeleteTxLookupEntriesByHash(batch, delivery.hashes)
DeleteTxLookupEntries(batch, delivery.hashes)
txs += len(delivery.hashes)
blocks++