Skip to content

Commit 74bb0c6

Browse files
author
eric
committed
fncy2: optimize the function of api_backend.go::SuggestPrice
1 parent de8b3dd commit 74bb0c6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

eth/api_backend.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package eth
1919
import (
2020
"context"
2121
"errors"
22+
"github.com/ethereum/go-ethereum/log"
2223
"math/big"
2324

2425
"github.com/ethereum/go-ethereum/accounts"
@@ -279,12 +280,14 @@ func (b *EthAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error) {
279280
//Fncy2 Update
280281
if b.ChainConfig().IsFncy2(b.Chain().CurrentBlock().Header().Number) {
281282
suggestPrice, err := b.gpo.SuggestPrice(ctx)
282-
if err != nil {
283-
gasprice := b.eth.TxPool().GasPriceWithoutLock()
283+
gasprice := b.eth.TxPool().GasPriceWithoutLock()
284+
if err == nil {
284285
if suggestPrice.Cmp(gasprice) < 0 {
285286
return gasprice, nil
286287
}
287288
}
289+
log.Warn("gpo.SuggestPrice ", "error ", err)
290+
return gasprice, nil
288291
}
289292
return b.gpo.SuggestPrice(ctx)
290293
}

0 commit comments

Comments
 (0)