fix off by one error in reorg

This commit is contained in:
Jack Robison 2020-12-16 01:27:03 -05:00
parent ee39e20e6d
commit 9bf72910a4
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -505,7 +505,6 @@ class BlockProcessor:
undo_entry_len = 12 + HASHX_LEN
for tx, tx_hash in reversed(txs):
self.db.total_transactions.pop()
for idx, txout in enumerate(tx.outputs):
# Spend the TX outputs. Be careful with unspendable
# outputs - we didn't save those in the first place.
@ -523,6 +522,8 @@ class BlockProcessor:
self.utxo_cache[txin.prev_hash + s_pack('<H', txin.prev_idx)] = undo_item
self.touched.add(undo_item[:-12])
self.db.total_transactions.pop()
assert n == 0
self.tx_count -= len(txs)