Skip to content

Commit

Permalink
Deal with rebroadcast madness
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Nov 27, 2024
1 parent 5b7ad53 commit af0f3cb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions eth_defi/confirmation.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,12 +761,18 @@ def wait_and_broadcast_multiple_nodes(
next_node_switch = datetime.datetime.utcnow() + node_switch_timeout

# Rebroadcast txs again if we suspect a broadcast failed
for tx in unconfirmed_txs:
try:
_broadcast_multiple_nodes(providers, tx)
last_exception = None
except Exception as e:
last_exception = e
# This path starts to get extra hard to handle - needs to be cleaned up
logger.info("Rebroadcast in progress")
for tx in txs:
if tx.hash in unconfirmed_txs:
logger.info("Rebroadcasting %s", tx)
try:
_broadcast_multiple_nodes(providers, tx)
last_exception = None
except Exception as e:
last_exception = e
else:
logger.info("Tx %s already successfully broadcasted", tx)

if last_exception:
raise last_exception
Expand Down

0 comments on commit af0f3cb

Please sign in to comment.