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]):
|
def finalize_transactions(_fork: Fork, diffs: list[DiffEntryItem]):
|
||||||
open_txs = set(db.session.scalars(select(TransactionJob.tx_id).where(
|
open_jobs = db.session.scalars(select(TransactionJob).where(
|
||||||
TransactionJob.chain == current_chain.get(),
|
TransactionJob.chain == current_chain.get(),
|
||||||
TransactionJob.state == TransactionJobState.Sent
|
TransactionJob.state == TransactionJobState.Sent
|
||||||
)).all())
|
)).all()
|
||||||
|
open_txs = {job.tx_id:job for job in open_jobs}
|
||||||
for diff in diffs:
|
for diff in diffs:
|
||||||
if diff.series == 'mined_txs' and diff.key in open_txs:
|
if diff.series == 'mined_txs' and diff.key in open_txs:
|
||||||
job = db.session.scalar(TransactionJob).where(
|
job = open_txs[diff.key]
|
||||||
TransactionJob.chain == current_chain.get(),
|
|
||||||
TransactionJob.state == TransactionJobState.Sent,
|
|
||||||
TransactionJob.tx_id == diff.key
|
|
||||||
).one()
|
|
||||||
job.state = TransactionJobState.Mined
|
job.state = TransactionJobState.Mined
|
||||||
job.receipt = diff.value
|
job.receipt = diff.value
|
||||||
db.session.add(job)
|
db.session.add(job)
|
||||||
|
|||||||
Reference in New Issue
Block a user