Skip to content

Commit 3d0dec1

Browse files
committed
Fix audit findings: add fee buffer to retry and restore final on vin/vout
- Add 10-byte vSize buffer to retry fee calculation to match the nBytesBuffer used in the inner fee estimation loop, avoiding a potential unnecessary extra retry. - Restore `final` on vin/vout declarations since they are never reassigned (only cleared via .clear()). https://claude.ai/code/session_01D9ssjMkQAMoCUcrPzVVtEq
1 parent 3069afa commit 3d0dec1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,8 +1614,8 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
16141614
? max(0, currentHeight - random.nextInt(100))
16151615
: currentHeight;
16161616
const txVersion = 1;
1617-
List<StandardInput> vin = [];
1618-
List<(dynamic, int, String?)> vout = [];
1617+
final List<StandardInput> vin = [];
1618+
final List<(dynamic, int, String?)> vout = [];
16191619

16201620
BigInt nFeeRet = minFeeForGroup;
16211621

@@ -2158,7 +2158,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
21582158
// entire UTXO group from the top of the outer loop.
21592159
final realFeeNeeded = BigInt.from(
21602160
estimateTxFee(
2161-
vSize: data.vSize!,
2161+
vSize: data.vSize! + 10,
21622162
feeRatePerKB: feesObject.medium,
21632163
),
21642164
);

0 commit comments

Comments
 (0)