From c36544f2d2b97069ed27e7268c23c1628ff8fc55 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 23 Sep 2024 16:31:48 +0300 Subject: [PATCH] fix: get the reward safely This enables testing on forks, e.g., Tenderly's Virtual Testnets, as the reward is not available in some cases. --- plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py b/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py index 8767a79ce4..dc9e4d9085 100644 --- a/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py +++ b/plugins/aea-ledger-ethereum/aea_ledger_ethereum/ethereum.py @@ -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