finalize transactions fix
This commit is contained in:
@@ -118,17 +118,14 @@ async def handle_transaction_receipts():
|
||||
|
||||
|
||||
def finalize_transactions(_fork: Fork, diffs: list[DiffEntryItem]):
|
||||
open_txs = set(db.session.scalars(select(TransactionJob.tx_id).where(
|
||||
TransactionJob.chain == current_chain.get(),
|
||||
TransactionJob.state == TransactionJobState.Sent
|
||||
)).all())
|
||||
open_jobs = db.session.scalars(select(TransactionJob).where(
|
||||
TransactionJob.chain == current_chain.get(),
|
||||
TransactionJob.state == TransactionJobState.Sent
|
||||
)).all()
|
||||
open_txs = {job.tx_id:job for job in open_jobs}
|
||||
for diff in diffs:
|
||||
if diff.series == 'mined_txs' and diff.key in open_txs:
|
||||
job = db.session.scalar(TransactionJob).where(
|
||||
TransactionJob.chain == current_chain.get(),
|
||||
TransactionJob.state == TransactionJobState.Sent,
|
||||
TransactionJob.tx_id == diff.key
|
||||
).one()
|
||||
job = open_txs[diff.key]
|
||||
job.state = TransactionJobState.Mined
|
||||
job.receipt = diff.value
|
||||
db.session.add(job)
|
||||
|
||||
Reference in New Issue
Block a user