Skip to content

Commit

Permalink
fix: get the reward safely
Browse files Browse the repository at this point in the history
This enables testing on forks, e.g., Tenderly's Virtual Testnets, as the reward is not available in some cases.
  • Loading branch information
Adamantios committed Sep 23, 2024
1 parent e60d953 commit c36544f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ def estimate_priority_fee(

# This is going to break if more percentiles are introduced in the future,
# i.e., `fee_history_percentile` param becomes a `List[int]`.
rewards = sorted([reward[0] for reward in fee_history["reward"] if reward[0] > 0])
rewards = sorted(
[reward[0] for reward in fee_history.get("reward", []) if reward[0] > 0]
)
if len(rewards) == 0:
return None

Expand Down

0 comments on commit c36544f

Please sign in to comment.