Unverified Commit 9921ca0f authored by Marius van der Wijden's avatar Marius van der Wijden Committed by GitHub

miner: allow for extradata in post-merge blocks (#26387)

* miner: allow for extradata in post-merge blocks

* miner: nits

* miner: remove extradata checks
parent 577db2ed
...@@ -959,13 +959,12 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP ...@@ -959,13 +959,12 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
// generateParams wraps various of settings for generating sealing task. // generateParams wraps various of settings for generating sealing task.
type generateParams struct { type generateParams struct {
timestamp uint64 // The timstamp for sealing task timestamp uint64 // The timestamp for sealing task
forceTime bool // Flag whether the given timestamp is immutable or not forceTime bool // Flag whether the given timestamp is immutable or not
parentHash common.Hash // Parent block hash, empty means the latest chain head parentHash common.Hash // Parent block hash, empty means the latest chain head
coinbase common.Address // The fee recipient address for including transaction coinbase common.Address // The fee recipient address for including transaction
random common.Hash // The randomness generated by beacon chain, empty before the merge random common.Hash // The randomness generated by beacon chain, empty before the merge
noUncle bool // Flag whether the uncle block inclusion is allowed noUncle bool // Flag whether the uncle block inclusion is allowed
noExtra bool // Flag whether the extra field assignment is allowed
noTxs bool // Flag whether an empty block without any transaction is expected noTxs bool // Flag whether an empty block without any transaction is expected
} }
...@@ -1001,8 +1000,8 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { ...@@ -1001,8 +1000,8 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
Time: timestamp, Time: timestamp,
Coinbase: genParams.coinbase, Coinbase: genParams.coinbase,
} }
// Set the extra field if it's allowed. // Set the extra field.
if !genParams.noExtra && len(w.extra) != 0 { if len(w.extra) != 0 {
header.Extra = w.extra header.Extra = w.extra
} }
// Set the randomness field from the beacon chain if it's available. // Set the randomness field from the beacon chain if it's available.
...@@ -1225,7 +1224,6 @@ func (w *worker) getSealingBlock(parent common.Hash, timestamp uint64, coinbase ...@@ -1225,7 +1224,6 @@ func (w *worker) getSealingBlock(parent common.Hash, timestamp uint64, coinbase
coinbase: coinbase, coinbase: coinbase,
random: random, random: random,
noUncle: true, noUncle: true,
noExtra: true,
noTxs: noTxs, noTxs: noTxs,
}, },
result: make(chan *newPayloadResult, 1), result: make(chan *newPayloadResult, 1),
......
...@@ -568,7 +568,7 @@ func testGetSealingWork(t *testing.T, chainConfig *params.ChainConfig, engine co ...@@ -568,7 +568,7 @@ func testGetSealingWork(t *testing.T, chainConfig *params.ChainConfig, engine co
} }
_, isClique := engine.(*clique.Clique) _, isClique := engine.(*clique.Clique)
if !isClique { if !isClique {
if len(block.Extra()) != 0 { if len(block.Extra()) != 2 {
t.Error("Unexpected extra field") t.Error("Unexpected extra field")
} }
if block.Coinbase() != coinbase { if block.Coinbase() != coinbase {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment