mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
eip 1559 in miner (#2773)
This commit is contained in:
parent
de16cb9e23
commit
044aa6748c
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/ledgerwatch/erigon/common"
|
"github.com/ledgerwatch/erigon/common"
|
||||||
"github.com/ledgerwatch/erigon/common/debug"
|
"github.com/ledgerwatch/erigon/common/debug"
|
||||||
"github.com/ledgerwatch/erigon/consensus"
|
"github.com/ledgerwatch/erigon/consensus"
|
||||||
|
"github.com/ledgerwatch/erigon/consensus/misc"
|
||||||
"github.com/ledgerwatch/erigon/core"
|
"github.com/ledgerwatch/erigon/core"
|
||||||
"github.com/ledgerwatch/erigon/core/rawdb"
|
"github.com/ledgerwatch/erigon/core/rawdb"
|
||||||
"github.com/ledgerwatch/erigon/core/types"
|
"github.com/ledgerwatch/erigon/core/types"
|
||||||
@ -210,11 +211,19 @@ func SpawnMiningCreateBlockStage(s *StageState, tx kv.RwTx, cfg MiningCreateBloc
|
|||||||
header := &types.Header{
|
header := &types.Header{
|
||||||
ParentHash: parent.Hash(),
|
ParentHash: parent.Hash(),
|
||||||
Number: num.Add(num, common.Big1),
|
Number: num.Add(num, common.Big1),
|
||||||
GasLimit: core.CalcGasLimit(parent.GasUsed, parent.GasLimit, cfg.miner.MiningConfig.GasFloor, cfg.miner.MiningConfig.GasCeil),
|
|
||||||
Extra: cfg.miner.MiningConfig.ExtraData,
|
Extra: cfg.miner.MiningConfig.ExtraData,
|
||||||
Time: uint64(timestamp),
|
Time: uint64(timestamp),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set baseFee and GasLimit if we are on an EIP-1559 chain
|
||||||
|
if cfg.chainConfig.IsLondon(header.Number.Uint64()) {
|
||||||
|
header.BaseFee = misc.CalcBaseFee(&cfg.chainConfig, parent)
|
||||||
|
if !cfg.chainConfig.IsLondon(parent.Number.Uint64()) {
|
||||||
|
parentGasLimit := parent.GasLimit * params.ElasticityMultiplier
|
||||||
|
header.GasLimit = core.CalcGasLimit(parent.GasUsed, parentGasLimit, cfg.miner.MiningConfig.GasFloor, cfg.miner.MiningConfig.GasCeil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Only set the coinbase if our consensus engine is running (avoid spurious block rewards)
|
// Only set the coinbase if our consensus engine is running (avoid spurious block rewards)
|
||||||
//if w.isRunning() {
|
//if w.isRunning() {
|
||||||
header.Coinbase = coinbase
|
header.Coinbase = coinbase
|
||||||
|
Loading…
Reference in New Issue
Block a user