fix pruned node integration test (#1223)

closes: #1222
This commit is contained in:
yihuang 2022-08-03 15:46:52 +08:00 committed by GitHub
parent 0e46b15e8d
commit 8d3a2b1df2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -862,8 +862,9 @@ func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) {
func (b *Backend) BaseFee(blockRes *tmrpctypes.ResultBlockResults) (*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 // return BaseFee if London hard fork is activated and feemarket is enabled
res, err := b.queryClient.BaseFee(types.ContextWithHeight(blockRes.Height), &evmtypes.QueryBaseFeeRequest{}) res, err := b.queryClient.BaseFee(types.ContextWithHeight(blockRes.Height), &evmtypes.QueryBaseFeeRequest{})
if err != nil { if err != nil || res.BaseFee == nil {
// fallback to parsing from begin blocker event, could happen on pruned nodes. // 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 // faster to iterate reversely
for i := len(blockRes.BeginBlockEvents) - 1; i >= 0; i-- { for i := len(blockRes.BeginBlockEvents) - 1; i >= 0; i-- {
evt := blockRes.BeginBlockEvents[i] evt := blockRes.BeginBlockEvents[i]