Skip to content

fix(wallet): keep change off protocol-reserved output values - #203

Merged
buffrr merged 2 commits into
spacesprotocol:subspacesfrom
buffrr:change-hygiene
Aug 26, 2026
Merged

fix(wallet): keep change off protocol-reserved output values#203
buffrr merged 2 commits into
spacesprotocol:subspacesfrom
buffrr:change-hygiene

Conversation

@buffrr

@buffrr buffrr commented Aug 26, 2026

Copy link
Copy Markdown
Member

No description provided.

buffrr added 2 commits August 26, 2026 13:06
A num is minted at value % 100 == 77 (delegation opt-in 78, revival 88)
and spaces track value % 10 == 2. In a spaces or num-minting tx these
are evaluated at every output, so a wallet change output that
coincidentally lands on one of these residues gets silently captured by
the protocol — e.g. the wallet's change becomes a num, locking the funds
into a num identity.

Sanitize the drain/change output before signing. `build_tx` pins
TxOrdering::Untouched and bdk appends the drain output last, so the
change (when present) is always the final output; it is nudged to the
nearest non-reserved value (down by at most 2 sats, absorbed by the fee)
only when it is unambiguously change: a multi-output tx, an is-mine
output on the internal (change) keychain, above the dust floor. Received
nums/spaces and funded-transfer maker outputs use the external keychain,
and the intentional space/num dust outputs sit below the dust floor, so
none of them are ever touched.
@buffrr
buffrr merged commit 96ac9d6 into spacesprotocol:subspaces Aug 26, 2026
16 of 17 checks passed
@buffrr
buffrr deleted the change-hygiene branch August 26, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant