Skip to content

Commit

Permalink
#351 fix canceller droping running transactions (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
otselnik authored and vasiliy-zaznobin committed Dec 7, 2021
1 parent ae7b392 commit 9feca6a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions proxy/indexer/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ def __init__(self, storage_account):


class ContinueStruct:
def __init__(self, signature, results, accounts = None):
def __init__(self, signature, results, slot, accounts = None):
self.signatures = [signature]
self.results = results
self.slot = slot
self.accounts = accounts


Expand Down Expand Up @@ -165,7 +166,7 @@ def process_receipts(self):
continue_result.signatures,
storage_account,
continue_result.accounts,
slot
max(slot, continue_result.slot)
)

del continue_table[storage_account]
Expand Down Expand Up @@ -271,6 +272,7 @@ def process_receipts(self):
logger.error("Strange behavior. Pay attention. BLOCKED ACCOUNTS NOT EQUAL")
trx_table[eth_signature].got_result = continue_result.results
trx_table[eth_signature].signatures += continue_result.signatures
trx_table[eth_signature].slot = max(trx_table[eth_signature].slot, continue_result.slot)

del continue_table[storage_account]

Expand All @@ -296,7 +298,7 @@ def process_receipts(self):

continue_table[storage_account].results = got_result
else:
continue_table[storage_account] = ContinueStruct(signature, got_result, blocked_accounts)
continue_table[storage_account] = ContinueStruct(signature, got_result, slot, blocked_accounts)

elif instruction_data[0] == 0x0b or instruction_data[0] == 0x16: # ExecuteTrxFromAccountDataIterative ExecuteTrxFromAccountDataIterativeV02
if instruction_data[0] == 0x0b:
Expand All @@ -319,7 +321,7 @@ def process_receipts(self):
else:
holder_table[holder_account] = HolderStruct(storage_account)
else:
continue_table[storage_account] = ContinueStruct(signature, None, blocked_accounts)
continue_table[storage_account] = ContinueStruct(signature, None, slot, blocked_accounts)
holder_table[holder_account] = HolderStruct(storage_account)


Expand All @@ -329,7 +331,7 @@ def process_receipts(self):
storage_account = trx['transaction']['message']['accountKeys'][instruction['accounts'][0]]
blocked_accounts = [trx['transaction']['message']['accountKeys'][acc_idx] for acc_idx in instruction['accounts'][6:]]

continue_table[storage_account] = ContinueStruct(signature, ([], "0x0", 0, [], trx['slot']), blocked_accounts)
continue_table[storage_account] = ContinueStruct(signature, ([], "0x0", 0, [], trx['slot']), slot, blocked_accounts)

elif instruction_data[0] == 0x0d:
# logger.debug("{:>10} {:>6} PartialCallOrContinueFromRawEthereumTX 0x{}".format(slot, counter, instruction_data.hex()))
Expand All @@ -349,6 +351,7 @@ def process_receipts(self):

if eth_signature in trx_table:
trx_table[eth_signature].signatures.append(signature)
trx_table[eth_signature].slot = max(trx_table[eth_signature].slot, slot)
else:
trx_table[eth_signature] = TransactionStruct(
eth_trx,
Expand Down Expand Up @@ -396,7 +399,7 @@ def process_receipts(self):

continue_table[storage_account].results = got_result
else:
continue_table[storage_account] = ContinueStruct(signature, got_result, blocked_accounts)
continue_table[storage_account] = ContinueStruct(signature, got_result, slot, blocked_accounts)
holder_table[holder_account] = HolderStruct(storage_account)

if instruction_data[0] > 0x16:
Expand Down

0 comments on commit 9feca6a

Please sign in to comment.