@@ -71,7 +71,7 @@ const updateBloom = (blockBloom: Buffer, bloom: Buffer) => {
7171const sortByPrice = ( values : TypedTransaction [ ] , a : number , b : number ) =>
7272 values [ a ] . effectiveGasPrice > values [ b ] . effectiveGasPrice ;
7373
74- const refresher = ( item : TypedTransaction , context : Quantity ) =>
74+ const refresher = ( item : TypedTransaction , context : bigint ) =>
7575 item . updateEffectiveGasPrice ( context ) ;
7676
7777export default class Miner extends Emittery < {
@@ -93,7 +93,7 @@ export default class Miner extends Emittery<{
9393 #isBusy: boolean = false ;
9494 #paused: boolean = false ;
9595 #resumer: Promise < void > ;
96- #currentBlockBaseFeePerGas: Quantity ;
96+ #currentBlockBaseFeePerGas: bigint ;
9797 #resolver: ( value : void ) => void ;
9898
9999 /**
@@ -127,10 +127,7 @@ export default class Miner extends Emittery<{
127127 }
128128
129129 // create a Heap that sorts by gasPrice
130- readonly #priced = new Heap < TypedTransaction , Quantity > (
131- sortByPrice ,
132- refresher
133- ) ;
130+ readonly #priced = new Heap < TypedTransaction , bigint > ( sortByPrice , refresher ) ;
134131 /*
135132 * @param executables - A live Map of pending transactions from the transaction
136133 * pool. The miner will update this Map by removing the best transactions
@@ -149,7 +146,7 @@ export default class Miner extends Emittery<{
149146 this . #executables = executables ;
150147 this . #createBlock = ( previousBlock : Block ) => {
151148 const newBlock = createBlock ( previousBlock ) ;
152- this . #setCurrentBlockBaseFeePerGas ( newBlock ) ;
149+ this . #currentBlockBaseFeePerGas = newBlock . header . baseFeePerGas ;
153150 return newBlock ;
154151 } ;
155152
@@ -182,7 +179,7 @@ export default class Miner extends Emittery<{
182179 this . #updatePricedHeap( ) ;
183180 return ;
184181 } else {
185- this . #setCurrentBlockBaseFeePerGas ( block ) ;
182+ this . #currentBlockBaseFeePerGas = block . header . baseFeePerGas ;
186183 this . #setPricedHeap( ) ;
187184 const result = await this . #mine( block , maxTransactions , onlyOneBlock ) ;
188185 this . emit ( "idle" ) ;
@@ -584,15 +581,4 @@ export default class Miner extends Emittery<{
584581 public toggleStepEvent ( enable : boolean ) {
585582 this . #emitStepEvent = enable ;
586583 }
587-
588- /**
589- * Sets the #currentBlockBaseFeePerGas property if the current block
590- * has a baseFeePerGas property
591- */
592- #setCurrentBlockBaseFeePerGas = ( block : RuntimeBlock ) => {
593- const baseFeePerGas = block . header . baseFeePerGas ;
594- // before london hard fork, there will be no baseFeePerGas on the block
595- this . #currentBlockBaseFeePerGas =
596- baseFeePerGas === undefined ? undefined : Quantity . from ( baseFeePerGas ) ;
597- } ;
598584}
0 commit comments