mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fix(GPO): min suggested tip cap if there's congestion to avoid filtering through DefaultIgnorePrice (#883)
This commit is contained in:
parent
f56dbb7c43
commit
ae45e1230e
2 changed files with 8 additions and 5 deletions
|
|
@ -38,7 +38,7 @@ const sampleNumber = 3 // Number of transactions sampled in a block
|
|||
|
||||
var (
|
||||
DefaultMaxPrice = big.NewInt(500 * params.GWei)
|
||||
DefaultIgnorePrice = big.NewInt(2 * params.Wei)
|
||||
DefaultIgnorePrice = big.NewInt(1 * params.Wei)
|
||||
DefaultBasePrice = big.NewInt(0)
|
||||
)
|
||||
|
||||
|
|
@ -194,10 +194,13 @@ func (oracle *Oracle) SuggestTipCap(ctx context.Context) (*big.Int, error) {
|
|||
// high-priced txs are causing the suggested tip cap to be high.
|
||||
pendingTxCount, _ := oracle.backend.Stats()
|
||||
if pendingTxCount < oracle.congestedThreshold {
|
||||
// Before Curie (EIP-1559), we need to return the total suggested gas price. After Curie we return 1 wei as the tip cap,
|
||||
// Before Curie (EIP-1559), we need to return the total suggested gas price. After Curie we return 2 wei as the tip cap,
|
||||
// as the base fee is set separately or added manually for legacy transactions.
|
||||
// Set price to 1 as otherwise tx with a 0 tip might be filtered out by the default mempool config.
|
||||
price := big.NewInt(1)
|
||||
// 1. Set price to at least 1 as otherwise tx with a 0 tip might be filtered out by the default mempool config.
|
||||
// 2. Since oracle.ignoreprice was set to 2 (DefaultIgnorePrice) before by default, we need to set the price
|
||||
// to 2 to avoid filtering in oracle.getBlockValues() by nodes that did not yet update to this version.
|
||||
// In the future we can set the price to 1 wei.
|
||||
price := big.NewInt(2)
|
||||
if !oracle.backend.ChainConfig().IsCurie(head.Number) {
|
||||
price = oracle.defaultBasePrice
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 5 // Major version component of the current release
|
||||
VersionMinor = 5 // Minor version component of the current release
|
||||
VersionPatch = 6 // Patch version component of the current release
|
||||
VersionPatch = 7 // Patch version component of the current release
|
||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue