From 93330876a0c35c4674ba0b08a0d339891082b1a7 Mon Sep 17 00:00:00 2001 From: rileystephens28 Date: Thu, 14 Nov 2024 17:10:51 -0600 Subject: [PATCH] Remove unused Qi tx multipliers and replace with flat 2x --- src/wallet/qi-hdwallet.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/wallet/qi-hdwallet.ts b/src/wallet/qi-hdwallet.ts index 19e0b18c..c1e380e0 100644 --- a/src/wallet/qi-hdwallet.ts +++ b/src/wallet/qi-hdwallet.ts @@ -571,7 +571,6 @@ export class QiHDWallet extends AbstractHDWallet { let attempts = 0; let finalFee = 0n; - let satisfiedFeeEstimation = false; const MAX_FEE_ESTIMATION_ATTEMPTS = 5; while (attempts < MAX_FEE_ESTIMATION_ATTEMPTS) { @@ -584,8 +583,8 @@ export class QiHDWallet extends AbstractHDWallet { finalFee = await this.provider.estimateFeeForQi(feeEstimationTx); - // Get new selection with updated fee - selection = fewestCoinSelector.performSelection(spendTarget, finalFee); + // Get new selection with updated fee 2x + selection = fewestCoinSelector.performSelection(spendTarget, finalFee * 2n); // Determine if new addresses are needed for the change outputs const changeAddressesNeeded = selection.changeOutputs.length - changeAddresses.length; @@ -618,19 +617,12 @@ export class QiHDWallet extends AbstractHDWallet { // If we need 5 or fewer new outputs, we can break the loop if ((changeAddressesNeeded <= 0 && spendAddressesNeeded <= 0) || totalNewOutputsNeeded <= 5) { - finalFee *= 3n; // Increase the fee 3x to ensure it's accepted - satisfiedFeeEstimation = true; break; } attempts++; } - // If we didn't satisfy the fee estimation, increase the fee 10x to ensure it's accepted - if (!satisfiedFeeEstimation) { - finalFee *= 10n; - } - // Proceed with creating and signing the transaction const chainId = (await this.provider.getNetwork()).chainId; const tx = await this.prepareTransaction(