feat(direct-send): allow specifying explicit input UTXOs by GuTS805 · Pull Request #588 · joinmarket-ng/joinmarket-ng · GitHub
Skip to content

feat(direct-send): allow specifying explicit input UTXOs - #588

Merged
github-actions[bot] merged 1 commit into
joinmarket-ng:mainfrom
GuTS805:feat/587-direct-send-input-utxos
Aug 12, 2026
Merged

feat(direct-send): allow specifying explicit input UTXOs#588
github-actions[bot] merged 1 commit into
joinmarket-ng:mainfrom
GuTS805:feat/587-direct-send-input-utxos

Conversation

@GuTS805

@GuTS805 GuTS805 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #587 (core + jmwalletd part; CLI support tracked as a follow-up per the issue discussion).

What

Adds an optional input_utxos field (list of "txid:vout" strings) to direct-send so a client can pin exactly which coins get spent instead of relying on automatic selection.

Behaviour

  • utxos must already be unfrozen — this endpoint does not freeze/unfreeze anything itself
  • every listed utxo must belong to the requested mixdepth, error otherwise
  • amount_sats: 0 + input_utxos sweeps exactly those inputs, nothing else
  • fidelity bonds are only accepted if expired and signable by this wallet, and only when explicitly listed
  • if the tx can't be built from exactly the given inputs, it errors with a reason (frozen / not found / wrong mixdepth / insufficient value / bond not expired / bond not signable) — no silent fallback to auto selection
  • empty list is always an error, not "no preference"
  • omitting the field keeps today's behaviour unchanged

Where

  • jmwallet/src/jmwallet/wallet/spend.pyparse_outpoint, resolve_input_utxos, and prepare_direct_send/direct_send accept the explicit list
  • jmwalletd/src/jmwalletd/models.pyDirectSendRequest.input_utxos
  • jmwalletd/src/jmwalletd/send.py, jmwalletd/src/jmwalletd/routers/coinjoin.py — pass it through to the wallet layer

Test plan

  • pytest jmwallet jmwalletd — full suite green except the 7 pre-existing WSL-only chmod failures in test_utxo_metadata.py (unrelated, root bypasses permission checks)
  • new unit tests for parse_outpoint / resolve_input_utxos / prepare_direct_send covering exact-spend, sweep, ordering, empty list, frozen, not-found, wrong-mixdepth, duplicates, insufficient value, expired/unexpired/unsignable bonds
  • new jmwalletd tests covering request forwarding and the ValueError -> 400 mapping
  • ruff clean

Follow-up (separate PR, per discussion in #587)

--input-utxo TXID:VOUT on jm-wallet send / jm-taker coinjoin, mutually exclusive with --select-utxos, and eventually the same for docoinjoin.

@m0wer
m0wer force-pushed the feat/587-direct-send-input-utxos branch from 7118a31 to 11ddf85 Compare August 11, 2026 15:56
@GuTS805

GuTS805 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@GuTS805
GuTS805 force-pushed the feat/587-direct-send-input-utxos branch from 1502163 to f28f3c0 Compare August 11, 2026 23:04
Adds an optional input_utxos field (list of "txid:vout" strings) to
direct-send so callers can pin exactly which coins get spent instead
of relying on automatic selection. Every listed UTXO must already be
unfrozen and belong to the requested mixdepth; anything unusable
(frozen, not found, wrong mixdepth, insufficient value, unexpired or
unsignable fidelity bond) is rejected with a specific reason rather
than silently falling back to auto-selection. Works for sweeps
(amount_sats: 0) as well as amount-based sends, and omitting the
field keeps prior behavior unchanged.

Backend + jmwalletd HTTP API only (issue joinmarket-ng#587); CLI support and
docoinjoin are tracked as separate follow-ups.

Changelog: Allow direct-send to spend an explicit list of input UTXOs instead of auto-selecting
@m0wer
m0wer force-pushed the feat/587-direct-send-input-utxos branch from f28f3c0 to f3e1b65 Compare August 12, 2026 06:21
@m0wer

m0wer commented Aug 12, 2026

Copy link
Copy Markdown
Member

/fast-forward

@github-actions

Copy link
Copy Markdown

@github-actions
github-actions Bot merged commit f3e1b65 into joinmarket-ng:main Aug 12, 2026
17 checks passed
@GuTS805
GuTS805 deleted the feat/587-direct-send-input-utxos branch August 12, 2026 11:51
@m0wer m0wer added the SoB Issues, PRs, tasks, and discussions related to Summer of Bitcoin. label Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SoB Issues, PRs, tasks, and discussions related to Summer of Bitcoin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow specifying input UTXOs for direct-send (and later docoinjoin)

2 participants