Skip to content

Commit

Permalink
fix(temp): logs for treasury-tx
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Apr 8, 2024
1 parent 7279a1b commit 3fea546
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/exporters/treasury_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ def insert_to_db(entry: LedgerEntry, ts: int) -> bool:
def _validate_integrity_error(entry: LedgerEntry, log_index: int) -> None:
''' Raises AssertionError if existing object that causes a TransactionIntegrityError is not an EXACT MATCH to the attempted insert. '''
existing_object = TreasuryTx.get(hash=entry.hash, log_index=log_index, chain=cache_chain())
if existing_object is None:
existing_objects = list(TreasuryTx.select(lambda tx: tx.hash==entry.hash and tx.log_index==log_index and tx.chain==cache_chain()))
raise ValueError(f'unable to `.get` due to multiple entries: {existing_objects}')
assert entry.to_address == existing_object.to_address.address, (entry.to_address,existing_object.to_address.address)
assert entry.from_address == existing_object.from_address.address, (entry.from_address, existing_object.from_address.address)
assert entry.value == existing_object.amount or entry.value == -1 * existing_object.amount, (entry.value, existing_object.amount)
Expand Down

0 comments on commit 3fea546

Please sign in to comment.