Skip to content

Commit

Permalink
Merge pull request #739 from tellor-io/btc-bal2
Browse files Browse the repository at this point in the history
Btc bal2
  • Loading branch information
0xSpuddy authored Jan 30, 2024
2 parents 14f4191 + 2fbf989 commit ed33d24
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/telliot_feeds/sources/btc_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ async def get_response(self) -> Optional[Any]:
logger.info("No transactions for this address")
return 0

for tx in data["txs"]:
if not tx.get("block_height") or not isinstance(tx["block_height"], int):
logger.error("Invalid transaction found: missing or non-integer block_height")
return None

# Sort transactions by time in ascending order
sorted_txs = sorted(data["txs"], key=lambda tx: (tx["block_height"], tx["tx_index"]))

Expand Down

0 comments on commit ed33d24

Please sign in to comment.