Add change type option to fundrawtransaction#12194
Add change type option to fundrawtransaction#12194jonasschnelli merged 3 commits intobitcoin:masterfrom
Conversation
|
Missing tests for the new option. |
|
might be a good candidate for another coincontrol field? concept ACK |
I thought the same, but coin control doesn't sound the best place to put it. Correct me if I'm wrong though. |
a5e687c to
6596d32
Compare
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
nit: missing , after )
There was a problem hiding this comment.
Not sure what you mean.
|
Concept ACK. |
c0e5b8e to
f46f06f
Compare
|
Thanks @instagibbs and @jonasschnelli, changed as requested. |
f46f06f to
4c74a8e
Compare
|
Reference #12177. |
|
Also see #11489 |
|
Needs tests. |
|
I am -0 on this one, I tend to like #12119 more. |
|
If change type is not explicit defined then it should follow #12119 logic for change type. I can rebase with that pull. WDYT? |
ryanofsky
left a comment
There was a problem hiding this comment.
utACK 4c74a8ef93d75e605feece08b150cdbd7260ec82. I think it's nice to be adding the coincontrol/fundraw option, if only to make it explicit that unless you override it (or changeAddress), then the type of change output will depend on global options the wallet was started up with. Notes:
- This PR will conflict with #12119, but the changes should be compatible (as promag pointed out). I don't have an opinion on which PR should be merged first or rebased on the other.
- It would be good to add a simple test to exercise the new code.
- It could be good if other RPCs calling CreateTransaction/SendMoney got a change_type option.
From what I can tell #12119 changes the
Will do.
Not sure about that though. I think this is useful for a migration period and targets expert users. |
4c74a8e to
bceb5da
Compare
|
Rebase and added test. |
src/wallet/coincontrol.h
Outdated
There was a problem hiding this comment.
Probably should add some comments distinguishing use between this and destChange right above.
Had to look up why both are required. (this being useful for non-prescribed destination, but prescribed destination type only)
src/wallet/rpcwallet.cpp
Outdated
There was a problem hiding this comment.
nit: maybe try to avoid additional "address" language for change stuff. "The output type to use for change"
There was a problem hiding this comment.
Also s/unspecified/not specified.
bceb5da to
79985b0
Compare
|
Slightly tested (running & tweaking fundraw test script) ACK 79985b052e8846c11a165ac9eabcc8767c32cbb6. Changes since last review were rebasing after #12119, adding test, adding change_type RPCTypeCheck, adding coincontrol comments. |
|
utACK 79985b0 non-blocking requests |
79985b0 to
16f6f59
Compare
| public: | ||
| //! Custom change destination, if not set an address is generated | ||
| CTxDestination destChange; | ||
| //! Custom change type, ignored if destChange is set, defaults to g_change_type |
There was a problem hiding this comment.
nit: the term "change type" seems not precise enough... I would have used change address type.
| //! Custom change destination, if not set an address is generated | ||
| CTxDestination destChange; | ||
| //! Custom change type, ignored if destChange is set, defaults to g_change_type | ||
| OutputType change_type; |
There was a problem hiding this comment.
nit: I guess this should haven been m_change_type?
|
utACK 16f6f59 |
16f6f59 [qa] Test fundrawtransaction with change_type option (João Barbosa) 536ddeb [rpc] Add change_type option to fundrawtransaction (João Barbosa) 31dbd5a [wallet] Add change type to CCoinControl (João Barbosa) Pull request description: Adds a new option `change_type` to `fundrawtransaction` RPC. This is useful to override the node `-changetype` argument. The new option is exclusive to `changeAddress` option, setting both raises a RPC error. See also #11403, #12119. Tree-SHA512: 654686444f6125e37015a62f167064d54ec335701534988447be4687fa5ef9c7980a8a07cc0a03fff6ea6c4c1abf0f77a8843d535c4f3fe0bf93f968a4e676e6
Adds a new option
change_typetofundrawtransactionRPC. This is useful to override the node-changetypeargument.The new option is exclusive to
changeAddressoption, setting both raises a RPC error.See also #11403, #12119.