@@ -553,14 +553,14 @@ const _minutesFromNow = (minutes: number) =>
553553 new Date ( Date . now ( ) + minutes * 60_000 ) ;
554554
555555/**
556- * Computes the aggressive gas fees to use when resending a transaction.
556+ * Computes aggressive gas fees when resending a transaction.
557557 *
558558 * For legacy transactions (pre-EIP1559):
559- * - Set gas price to 2 * current attempt, capped at 10x.
559+ * - Gas price = ( 2 * attempt) * estimatedGasPrice , capped at 10x.
560560 *
561- * For transactions with maxFeePerGas + maxPriorityFeePerGas :
562- * - Set maxPriorityFeePerGas to 2x current attempt, capped at 10x.
563- * - Set maxFeePerGas to 2 * current max fee, plus the maxPriorityFeePerGas.
561+ * For other transactions :
562+ * - maxPriorityFeePerGas = (2 * attempt) * estimatedMaxPriorityFeePerGas , capped at 10x.
563+ * - maxFeePerGas = ( 2 * estimatedMaxFeePerGas) + maxPriorityFeePerGas.
564564 *
565565 * @param populatedTransaction The transaction with estimated gas from RPC.
566566 * @param resendCount The resend attempt #. Example: 2 = the transaction was initially sent, then resent once. This is the second resend attempt.
@@ -577,14 +577,15 @@ export const _updateGasFees = (
577577 const multiplier = BigInt ( Math . min ( 10 , resendCount * 2 ) ) ;
578578
579579 const updated = { ...populatedTransaction } ;
580- if ( updated . gasPrice ) {
580+
581+ // Update gas fees (unless they were explicitly overridden).
582+
583+ if ( updated . gasPrice && ! overrides ?. gasPrice ) {
581584 updated . gasPrice *= multiplier ;
582585 }
583- // Don't update gas fees that are explicitly overridden.
584586 if ( updated . maxPriorityFeePerGas && ! overrides ?. maxPriorityFeePerGas ) {
585587 updated . maxPriorityFeePerGas *= multiplier ;
586588 }
587- // Don't update gas fees that are explicitly overridden.
588589 if ( updated . maxFeePerGas && ! overrides ?. maxFeePerGas ) {
589590 updated . maxFeePerGas =
590591 updated . maxFeePerGas * 2n + ( updated . maxPriorityFeePerGas ?? 0n ) ;
0 commit comments