Skip to content

Commit

Permalink
Merge pull request #46 from cowprotocol/filter-reverts
Browse files Browse the repository at this point in the history
Filter Out Reverted Txs
  • Loading branch information
harisang authored Aug 25, 2024
2 parents 29e93cb + 65ee0b6 commit 60293fd
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 60293fd

Please sign in to comment.