Skip to content

Commit

Permalink
Merge pull request #1286 from pataegrillo/removing_transaction_output…
Browse files Browse the repository at this point in the history
…s_from_undo

Removed the transaction_outputs table from undo_tables, now it gets trimmed like the tables blocks and transactions
  • Loading branch information
jdogresorg authored Dec 2, 2023
2 parents 23bfc8b + 4b3775d commit e65172a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion counterpartylib/lib/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
'rps_match_expirations', 'rps_expirations', 'rpsresolves',
'rps_matches', 'rps',
'destructions', 'assets', 'addresses', 'sweeps', 'dispensers', 'dispenses',
'transaction_outputs','dispenser_refills']
'dispenser_refills']
# Compose list of tables tracked by undolog
UNDOLOG_TABLES = copy.copy(TABLES)
UNDOLOG_TABLES.remove('messages')
Expand Down Expand Up @@ -984,6 +984,7 @@ def reinitialise(db, block_index=None):

# For rollbacks, just delete new blocks and then reparse what’s left.
if block_index:
cursor.execute('''DELETE FROM transaction_outputs WHERE block_index > ?''', (block_index,))
cursor.execute('''DELETE FROM transactions WHERE block_index > ?''', (block_index,))
cursor.execute('''DELETE FROM blocks WHERE block_index > ?''', (block_index,))
elif config.TESTNET or config.REGTEST: # block_index NOT specified and we are running testnet
Expand Down Expand Up @@ -1044,6 +1045,7 @@ def get_block_index_for_undo_index(undo_indexes, undo_index):
undolog_cursor.execute(entry[1])

# Trim back tx and blocks
undolog_cursor.execute('''DELETE FROM transaction_outputs WHERE block_index > ?''', (block_index,))
undolog_cursor.execute('''DELETE FROM transactions WHERE block_index > ?''', (block_index,))
undolog_cursor.execute('''DELETE FROM blocks WHERE block_index > ?''', (block_index,))
# As well as undolog entries...
Expand Down

0 comments on commit e65172a

Please sign in to comment.