fix off by one error in reorg
This commit is contained in:
parent
ee39e20e6d
commit
9bf72910a4
1 changed files with 2 additions and 1 deletions
|
@ -505,7 +505,6 @@ class BlockProcessor:
|
||||||
undo_entry_len = 12 + HASHX_LEN
|
undo_entry_len = 12 + HASHX_LEN
|
||||||
|
|
||||||
for tx, tx_hash in reversed(txs):
|
for tx, tx_hash in reversed(txs):
|
||||||
self.db.total_transactions.pop()
|
|
||||||
for idx, txout in enumerate(tx.outputs):
|
for idx, txout in enumerate(tx.outputs):
|
||||||
# Spend the TX outputs. Be careful with unspendable
|
# Spend the TX outputs. Be careful with unspendable
|
||||||
# outputs - we didn't save those in the first place.
|
# 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.utxo_cache[txin.prev_hash + s_pack('<H', txin.prev_idx)] = undo_item
|
||||||
self.touched.add(undo_item[:-12])
|
self.touched.add(undo_item[:-12])
|
||||||
|
|
||||||
|
self.db.total_transactions.pop()
|
||||||
|
|
||||||
assert n == 0
|
assert n == 0
|
||||||
self.tx_count -= len(txs)
|
self.tx_count -= len(txs)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue