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 {
129
129
return true
130
130
}
131
131
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
+
132
138
// SetEtherbase sets the etherbase of the miner
133
139
func (api * PrivateMinerAPI ) SetEtherbase (etherbase common.Address ) bool {
134
140
api .e .SetEtherbase (etherbase )
Original file line number Diff line number Diff line change @@ -641,6 +641,12 @@ web3._extend({
641
641
params: 1,
642
642
inputFormatter: [web3._extend.utils.fromDecimal]
643
643
}),
644
+ new web3._extend.Method({
645
+ name: 'setGasLimit',
646
+ call: 'miner_setGasLimit',
647
+ params: 1,
648
+ inputFormatter: [web3._extend.utils.fromDecimal]
649
+ }),
644
650
new web3._extend.Method({
645
651
name: 'setRecommitInterval',
646
652
call: 'miner_setRecommitInterval',
Original file line number Diff line number Diff line change @@ -204,6 +204,12 @@ func (miner *Miner) SetEtherbase(addr common.Address) {
204
204
miner .worker .setEtherbase (addr )
205
205
}
206
206
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
+
207
213
// EnablePreseal turns on the preseal mining feature. It's enabled by default.
208
214
// Note this function shouldn't be exposed to API, it's unnecessary for users
209
215
// (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) {
244
244
w .coinbase = addr
245
245
}
246
246
247
+ func (w * worker ) setGasCeil (ceil uint64 ) {
248
+ w .mu .Lock ()
249
+ defer w .mu .Unlock ()
250
+ w .config .GasCeil = ceil
251
+ }
252
+
247
253
// setExtra sets the content used to initialize the block extra field.
248
254
func (w * worker ) setExtra (extra []byte ) {
249
255
w .mu .Lock ()
You can’t perform that action at this time.
0 commit comments