Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 3772419

Browse files
committed
clean up how we cache baseFee in miner
1 parent 55c37b5 commit 3772419

File tree

1 file changed

+2
-13
lines changed
  • src/chains/ethereum/ethereum/src/miner

1 file changed

+2
-13
lines changed

src/chains/ethereum/ethereum/src/miner/miner.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export default class Miner extends Emittery<{
146146
this.#executables = executables;
147147
this.#createBlock = (previousBlock: Block) => {
148148
const newBlock = createBlock(previousBlock);
149-
this.#setCurrentBlockBaseFeePerGas(newBlock);
149+
this.#currentBlockBaseFeePerGas = newBlock.header.baseFeePerGas;
150150
return newBlock;
151151
};
152152

@@ -179,7 +179,7 @@ export default class Miner extends Emittery<{
179179
this.#updatePricedHeap();
180180
return;
181181
} else {
182-
this.#setCurrentBlockBaseFeePerGas(block);
182+
this.#currentBlockBaseFeePerGas = block.header.baseFeePerGas;
183183
this.#setPricedHeap();
184184
const result = await this.#mine(block, maxTransactions, onlyOneBlock);
185185
this.emit("idle");
@@ -581,15 +581,4 @@ export default class Miner extends Emittery<{
581581
public toggleStepEvent(enable: boolean) {
582582
this.#emitStepEvent = enable;
583583
}
584-
585-
/**
586-
* Sets the #currentBlockBaseFeePerGas property if the current block
587-
* has a baseFeePerGas property
588-
*/
589-
#setCurrentBlockBaseFeePerGas = (block: RuntimeBlock) => {
590-
const baseFeePerGas = block.header.baseFeePerGas;
591-
// before london hard fork, there will be no baseFeePerGas on the block
592-
this.#currentBlockBaseFeePerGas =
593-
baseFeePerGas === undefined ? undefined : baseFeePerGas;
594-
};
595584
}

0 commit comments

Comments
 (0)