Skip to content

Commit

Permalink
filter out revert txs
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhagarwal03 committed Aug 25, 2024
1 parent 29e93cb commit 65ee0b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/helpers/blockchain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ def get_tx_hashes_blocks(
involving the settlement contract.
"""
tx_hashes_blocks = []

for block_number in range(start_block, end_block + 1):
block = self.web3.eth.get_block(block_number, full_transactions=True)
for tx in block.transactions: # type: ignore[attr-defined]
if tx.to and tx.to.lower() == SETTLEMENT_CONTRACT_ADDRESS.lower():
tx_hashes_blocks.append((tx.hash.to_0x_hex(), block_number))
receipt = self.web3.eth.get_transaction_receipt(tx.hash)
# status = 0 indicates a reverted tx, status = 1 is successful tx
if receipt.status == 1: # type: ignore[attr-defined]
tx_hashes_blocks.append((tx.hash.to_0x_hex(), block_number))
return tx_hashes_blocks

def get_auction_id(self, tx_hash: str) -> int:
Expand Down

0 comments on commit 65ee0b6

Please sign in to comment.