File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,12 @@ func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
129129 return true
130130}
131131
132+ // SetGasLimit sets the gaslimit to target towards during mining.
133+ func (api * PrivateMinerAPI ) SetGasLimit (gasLimit hexutil.Uint64 ) bool {
134+ api .e .Miner ().SetGasCeil (uint64 (gasLimit ))
135+ return true
136+ }
137+
132138// SetEtherbase sets the etherbase of the miner
133139func (api * PrivateMinerAPI ) SetEtherbase (etherbase common.Address ) bool {
134140 api .e .SetEtherbase (etherbase )
Original file line number Diff line number Diff line change @@ -641,6 +641,12 @@ web3._extend({
641641 params: 1,
642642 inputFormatter: [web3._extend.utils.fromDecimal]
643643 }),
644+ new web3._extend.Method({
645+ name: 'setGasLimit',
646+ call: 'miner_setGasLimit',
647+ params: 1,
648+ inputFormatter: [web3._extend.utils.fromDecimal]
649+ }),
644650 new web3._extend.Method({
645651 name: 'setRecommitInterval',
646652 call: 'miner_setRecommitInterval',
Original file line number Diff line number Diff line change @@ -204,6 +204,12 @@ func (miner *Miner) SetEtherbase(addr common.Address) {
204204 miner .worker .setEtherbase (addr )
205205}
206206
207+ // SetGasCeil sets the gaslimit to strive for when mining blocks post 1559.
208+ // For pre-1559 blocks, it sets the ceiling.
209+ func (miner * Miner ) SetGasCeil (ceil uint64 ) {
210+ miner .worker .setGasCeil (ceil )
211+ }
212+
207213// EnablePreseal turns on the preseal mining feature. It's enabled by default.
208214// Note this function shouldn't be exposed to API, it's unnecessary for users
209215// (miners) to actually know the underlying detail. It's only for outside project
Original file line number Diff line number Diff line change @@ -244,6 +244,12 @@ func (w *worker) setEtherbase(addr common.Address) {
244244 w .coinbase = addr
245245}
246246
247+ func (w * worker ) setGasCeil (ceil uint64 ) {
248+ w .mu .Lock ()
249+ defer w .mu .Unlock ()
250+ w .config .GasCeil = ceil
251+ }
252+
247253// setExtra sets the content used to initialize the block extra field.
248254func (w * worker ) setExtra (extra []byte ) {
249255 w .mu .Lock ()
You can’t perform that action at this time.
0 commit comments