From e2e67de40f3fcd0063a0a79477aecf0ac741f462 Mon Sep 17 00:00:00 2001 From: Deggen Date: Thu, 9 Apr 2026 08:36:12 -0500 Subject: [PATCH] fix: clamp changeInitialSatoshis to minimum of 1 When a basket's minimumDesiredUTXOValue is 0 (e.g. from corrupted remote storage config), all createAction calls fail validation. This matches the existing Math.max(1, ...) pattern already used for changeFirstSatoshis on the next line. Fixes bsv-blockchain/bsv-desktop#32 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/storage/methods/createAction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/methods/createAction.ts b/src/storage/methods/createAction.ts index ed4d828a..953f9c3a 100644 --- a/src/storage/methods/createAction.ts +++ b/src/storage/methods/createAction.ts @@ -841,7 +841,7 @@ async function fundNewTransactionSdk( lockingScriptLength: xo.lockingScript.length / 2 })), feeModel: ctx.feeModel, - changeInitialSatoshis: ctx.changeBasket.minimumDesiredUTXOValue, + changeInitialSatoshis: Math.max(1, ctx.changeBasket.minimumDesiredUTXOValue), changeFirstSatoshis: Math.max(1, Math.round(ctx.changeBasket.minimumDesiredUTXOValue / 4)), changeLockingScriptLength: 25, changeUnlockingScriptLength: 107,