Skip to content
This repository was archived by the owner on Jun 12, 2026. It is now read-only.

fix: clamp changeInitialSatoshis to minimum of 1 - #147

Merged
tonesnotes merged 1 commit into
masterfrom
fix/clamp-change-initial-satoshis
Apr 9, 2026
Merged

fix: clamp changeInitialSatoshis to minimum of 1#147
tonesnotes merged 1 commit into
masterfrom
fix/clamp-change-initial-satoshis

Conversation

@sirdeggen

Copy link
Copy Markdown
Contributor

Summary

  • Clamps changeInitialSatoshis to Math.max(1, ...) in createAction.ts, matching the existing pattern used for changeFirstSatoshis on the next line.
  • Prevents all createAction calls from failing when a basket's minimumDesiredUTXOValue is 0 (e.g. from corrupted or legacy remote storage config).

Context

When using remote storage (e.g. storage.babbage.systems), the default basket's minimumDesiredUTXOValue can end up as 0. This flows directly into changeInitialSatoshis, which then fails validateSatoshis(..., 1) in generateChange.ts — blocking every transaction even when the wallet has funds.

Previously users had to manually reset basket params via a diagnostic tool in bsv-desktop. This one-line fix makes that unnecessary.

Fixes bsv-blockchain/bsv-desktop#32

Test plan

  • Verify createAction succeeds when basket has minimumDesiredUTXOValue: 0
  • Verify normal behavior unchanged when minimumDesiredUTXOValue >= 1

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Apr 9, 2026

Copy link
Copy Markdown

@tonesnotes
tonesnotes merged commit a0cd8db into master Apr 9, 2026
8 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Payments fail with createHmac and changeInitialSatoshis errors

2 participants