AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 37 Bitcoin

Merge bitcoin/bitcoin#36344: wallet: reject duplicate inputs in sendall

Public commit record

What the developer wrote

Authored by merge-script

100/100 · Strong
Merge bitcoin/bitcoin#36344: wallet: reject duplicate inputs in sendall

654a92a9d3e76f3ff4ec4975f4fbcfba1a6091be wallet: reject duplicate inputs in sendall (Bruce0X)

Pull request description:

`sendall` with the `inputs` option doesn't check for duplicates. Each listed input is added to `total_input_value` in the loop at spend.cpp:1472, so passing the same UTXO twice counts its value twice.

On regtest, with a wallet that has a single 1 BTC UTXO:

```
sendall '["<addr>"]' '{"inputs": [<utxo>, <utxo>]}'
```

- the RPC returns `complete: true`
- the committed tx has 2 inputs (the same outpoint twice) and one output of 1.99998230 BTC
- it isn't in the mempool, and `testmempoolaccept` rejects it with `bad-txns-inputs-duplicate`
- after that, `listunspent` is empty and `getbalances` shows `nonmempool: -1.0` until the tx is abandoned

`send` and `walletcreatefundedpsbt` aren't affected, because `CCoinControl::Select` removes duplicates.

This rejects a duplicated input with `Invalid parameter, duplicated input: <txid>:<vout>` (RPC_INVALID_PARAMETER). The message matches what `createrawtransaction` says for duplicated addresses. The new `sendall_fails_on_duplicate_input` test fails on master ("No exception raised") and passes with the fix. `wallet_send.py` still passes.

ACKs for top commit:
l0rinc:
ACK 654a92a9d3e76f3ff4ec4975f4fbcfba1a6091be
maflcko:
review ACK 654a92a9d3e76f3ff4ec4975f4fbcfba1a6091be 🚪
molnard:
tACK 654a92a9d3e76f3ff4ec4975f4fbcfba1a6091be

Tree-SHA512: ae8541f9458a12e97d6c516cd2327519d2be8cf0e7501622c7a9d295ecbfd61290d7f874e205cf1e8fc8bcc147edc55e4d773fbe700b6a20db4a7071a9a97b19
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This patch fixes a bug in Bitcoin Core's `sendall` wallet RPC command. Previously, if a user accidentally listed the same coin (UTXO) twice in the `inputs` option, the command would create an invalid transaction that counted the coin's value twice. The transaction would be rejected by the network, but it would temporarily confuse the wallet's balance display. The fix now rejects duplicate inputs immediately with a clear error message.

Recommended action

Apply the patch. It is a low-risk, defensive validation fix with a regression test. No immediate incident response is required because the invalid transactions cannot be mined or relayed.

Security signals we found

01

Input validation bypass leading to creation of an invalid transaction

02

Wallet balance accounting temporarily corrupted (negative nonmempool balance)

03

Denial-of-service-like user impact: funds appear missing until transaction is abandoned

04

No network-level consensus impact; transactions are rejected by mempool policy

Risk score

Why this scored 37/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.