From 8d3a2b1df24cada19a4da70da7d6db430deca4f9 Mon Sep 17 00:00:00 2001 From: yihuang Date: Wed, 3 Aug 2022 15:46:52 +0800 Subject: [PATCH] fix pruned node integration test (#1223) closes: #1222 --- rpc/backend/evm_backend.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rpc/backend/evm_backend.go b/rpc/backend/evm_backend.go index 13e6d7b0..4abad1e8 100644 --- a/rpc/backend/evm_backend.go +++ b/rpc/backend/evm_backend.go @@ -862,8 +862,9 @@ func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) { func (b *Backend) BaseFee(blockRes *tmrpctypes.ResultBlockResults) (*big.Int, error) { // return BaseFee if London hard fork is activated and feemarket is enabled res, err := b.queryClient.BaseFee(types.ContextWithHeight(blockRes.Height), &evmtypes.QueryBaseFeeRequest{}) - if err != nil { - // fallback to parsing from begin blocker event, could happen on pruned nodes. + if err != nil || res.BaseFee == nil { + // we can't tell if it's london HF not enabled or the state is pruned, + // in either case, we'll fallback to parsing from begin blocker event, // faster to iterate reversely for i := len(blockRes.BeginBlockEvents) - 1; i >= 0; i-- { evt := blockRes.BeginBlockEvents[i]