Repository navigation
rpc: bugfix, 'add_inputs' default value is true unless 'inputs' are provided - #26053
Conversation
amovfx
left a comment
There was a problem hiding this comment.
I appreciated how well your test was commented. That really helps someone new like me read whats going on.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
2e37f0a to
1350349
Compare
|
Thanks MarkoFalke, feedback tackled. Changed |
aureleoules
left a comment
There was a problem hiding this comment.
ACK 1350349f5951a4e1fdc7d92018cb5be6c014e99a.
Verified that m_allow_other_inputs is overridden when inputs are passed.
nit if you retouch: use .empty() instead of .size() == 0.
bitcoin/src/wallet/rpc/spend.cpp
Line 1228 in d338712
|
Code Review ACK 1350349f5951a4e1fdc7d92018cb5be6c014e99a Verified that the new help text is consistent with the behaviour. I agree that the new help text is less confusing. |
…rovided In both RPC commands `send()` and `walletcreatefundedpsbt` the RPC help was saying that `add_inputs` default value was false when it's actually dynamically set by the following statement: `coin_control.m_allow_other_inputs = rawTx.vin.size() == 0;` Which means that, by default, `add_inputs` is true unless there was any pre-set input, in which case, the default is false.
1350349 to
40b2010
Compare
|
Thanks achow101, feedback tackled (and a bit more). Added two new test scenarios:
|
|
ACK 40b20102371d9fa6ae3dcdcb32a678a940e1130a |
Covered cases for send() and walletcreatefundedpsbt() RPC commands:
1. Default add_inputs value with no preset inputs (add_inputs=true):
Expect: automatically add coins from the wallet to the tx.
2. Default add_inputs value with preset inputs (add_inputs=false):
Expect: disallow automatic coin selection.
3. Explicit add_inputs=true and preset inputs (with preset inputs not-covering the target amount).
Expect: include inputs from the wallet.
4. Explicit add_inputs=true and preset inputs (with preset inputs covering the target amount).
Expect: only preset inputs are used.
5. Explicit add_inputs=true, no preset inputs (same as (1) but with an explicit set):
Expect: include inputs from the wallet.
40b2010 to
b00fc44
Compare
|
ACK b00fc44 |
1 similar comment
|
ACK b00fc44 |
This bugfix was meant to be in #25685, but decoupled it to try to make it part of 24.0 release.
It's a truly misleading functionality.
This PR doesn't change behavior in any way. Just fixes two invalid RPC help messages and adds test
coverage for the current behavior.
Description
In both RPC commands
send()andwalletcreatefundedpsbtthe help message saysthat
add_inputsdefault value is false when it's actually dynamically set by the following statement:coin_control.m_allow_other_inputs = rawTx.vin.size() == 0;Which means that, by default,
add_inputsis true unless there is any pre-set input, in whichcase, the default is false.