Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get gas price suggestion from the correct block #817

Merged
merged 6 commits into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing error handling
  • Loading branch information
mrsmkl committed Jan 23, 2020
commit c69f117f35d8bf451af2fd537e3ba7d739fe8675
9 changes: 6 additions & 3 deletions contract_comm/gasprice_minimum/gasprice_minimum.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/ethereum/go-ethereum/contract_comm/errors"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
)

Expand Down Expand Up @@ -101,11 +100,9 @@ func GetGasPriceMinimum(currency *common.Address, header *types.Header, state vm
return FallbackGasPriceMinimum, nil
}
if err == errors.ErrNoInternalEvmHandlerSingleton {
log.Error(err.Error())
return FallbackGasPriceMinimum, nil
}
if err != nil {
log.Error(err.Error())
return FallbackGasPriceMinimum, err
}
} else {
Expand All @@ -124,6 +121,12 @@ func GetGasPriceMinimum(currency *common.Address, header *types.Header, state vm
state,
)

if err == errors.ErrSmartContractNotDeployed || err == errors.ErrRegistryContractNotDeployed {
return FallbackGasPriceMinimum, nil
}
if err == errors.ErrNoInternalEvmHandlerSingleton {
return FallbackGasPriceMinimum, nil
}
if err != nil {
return FallbackGasPriceMinimum, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ func (s *PublicBlockChainAPI) doCall(ctx context.Context, args CallArgs, blockNr
if gasPrice.Sign() == 0 || gasPrice.Cmp(big.NewInt(0)) == 0 {
gasPrice, err = s.b.SuggestPriceInCurrency(ctx, args.FeeCurrency, header, state)
mrsmkl marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
log.Error("Error suggesting gas price", gasPrice, "block", blockNr, "err", err)
log.Error("Error suggesting gas price", "block", blockNr, "err", err)
return nil, 0, false, err
}
}
Expand Down