-
Notifications
You must be signed in to change notification settings - Fork 37.8k
[wallet] couple of walletcreatefundedpsbt fixes #13968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the first commit also effects createrawtransaction
.
src/wallet/rpcwallet.cpp
Outdated
@@ -4715,10 +4714,16 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request) | |||
}, true | |||
); | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: miscellaneous whitespace change
src/wallet/rpcwallet.cpp
Outdated
CAmount fee; | ||
int change_position; | ||
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3]); | ||
FundTransaction(pwallet, rawTx, fee, change_position, request.params[4]); | ||
// Make a copy and edit replaceability in-place | ||
UniValue params_copy(request.params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct. The parameters for these options are in request.params[4]
but what you are doing here is adding it to request.params
so when replaceable
is looked up in params_copy[4]
, it won't be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derp
6a5822d
to
ac0778b
Compare
src/wallet/rpcwallet.cpp
Outdated
if (!request.params[3].isNull()){ | ||
params_copy.pushKV("replaceable", request.params[3].get_bool()); | ||
} | ||
FundTransaction(pwallet, rawTx, fee, change_position, params_copy[4]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be params_copy
, not params_copy[4]
.
src/wallet/rpcwallet.cpp
Outdated
// Make a copy and edit replaceability in-place | ||
UniValue params_copy(request.params[4]); | ||
if (!request.params[3].isNull()){ | ||
params_copy.pushKV("replaceable", request.params[3].get_bool()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose someone already has replaceable
set in their options (because they copied it from fundrawtransaction
or something). How does this interact with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what's best in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I can reverse my decision and only use the option's version.
ac0778b
to
2020fe1
Compare
reworked to preseve the options |
pushed basic functional test |
I'll note that when locktime == 0, |
Can I get 0.17 backport tag? This is a bugfix. |
? Isn't 0.17 the first release with PSBT?
…On Sun, Aug 19, 2018, 6:05 PM João Barbosa ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/wallet/rpcwallet.cpp
<#13968 (comment)>:
> @@ -4670,9 +4670,8 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
" accepted as second parameter.\n"
" ]\n"
"3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n"
- "4. replaceable (boolean, optional, default=false) Marks this transaction as BIP125 replaceable.\n"
Can this be done? This was already released. At least add a release note?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13968 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFgC00pHDttEoIq9rL8lAL8PnsPDrj0hks5uSeEPgaJpZM4V8-M0>
.
|
Yes, does that matter? |
So it's not in a release yet? |
🤦♂️ it's not released.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should update L4646:
if (request.fHelp || request.params.size() < 2 || request.params.size() > 5)
And vRPCConvertParams
in src/rpc/client.cpp
.
3d3f08a
to
547bc0f
Compare
Looks like we're also missing the arg type check for the |
547bc0f
to
faaac5c
Compare
Note to reviewers: 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. |
utACK faaac5c |
1 similar comment
utACK faaac5c |
faaac5c RPCTypeCheck bip32derivs arg in walletcreatefunded (Gregory Sanders) 1f0c428 QA: add basic walletcreatefunded optional arg test (Gregory Sanders) 1f18d7b walletcreatefundedpsbt: remove duplicate replaceable arg (Gregory Sanders) 2252ec5 Allow ConstructTransaction to not throw error with 0-input txn (Gregory Sanders) Pull request description: 1) Previously an empty input argument transaction that is marked for replaceability fails to pass the `SignalsOptInRBF` check right before funding it. Explicitly check for that condition before throwing an error. 2) The rpc call had two separate `replaceable` arguments, each of which being used in mutually exclusive places. I preserved the `options` version to retain compatability with `fundtransaction`. Tree-SHA512: 26eb0c9e2d38ea51d11f741d61100223253271a084adadeb7e78c6d4e9004636f089e4273c5bf64a41bd7e9ff795317acf30531cb36aeb0d8db9304b3c8270c3
Github-Pull: bitcoin#13968 Rebased-From: 2252ec5 Tree-SHA512: 1f9978ee25fbe9bb338af19d81b401fa531d314ac8288cdb21c1bf10459edea50b43e2d5e97c9bb5fe24c8db89363f8233c0a3d96066ed85f7bd6d2eb234aac0
Github-Pull: bitcoin#13968 Rebased-From: 1f18d7b Tree-SHA512: 90391703181db6880a135c60aca792a9e92c4abcad26907cd6cb0a0378593fe45cf995a22ae142ea7de2767c72a9df444e918ff15e460ce19c0435163917d812
Github-Pull: bitcoin#13968 Rebased-From: 1f0c428 Tree-SHA512: 1f8b10629a314f623d589801ef2e62724de2cd82a0e523e0ab25a285f92b76a3b31304c1c0418b1b611ec3ca0016016d1e6af410ac81a78449b875c4f89a46d7
Github-Pull: bitcoin#13968 Rebased-From: faaac5c Tree-SHA512: 758c0c3e4435897d1a9b03ea93f1b2a1a1b64071eda9450f968acf537c172ee61acf9d962bc22ddb6de26e0ad39d9165cdee6f260bb5a95bf97b4003853f0874
faaac5c RPCTypeCheck bip32derivs arg in walletcreatefunded (Gregory Sanders) 1f0c428 QA: add basic walletcreatefunded optional arg test (Gregory Sanders) 1f18d7b walletcreatefundedpsbt: remove duplicate replaceable arg (Gregory Sanders) 2252ec5 Allow ConstructTransaction to not throw error with 0-input txn (Gregory Sanders) Pull request description: 1) Previously an empty input argument transaction that is marked for replaceability fails to pass the `SignalsOptInRBF` check right before funding it. Explicitly check for that condition before throwing an error. 2) The rpc call had two separate `replaceable` arguments, each of which being used in mutually exclusive places. I preserved the `options` version to retain compatability with `fundtransaction`. Tree-SHA512: 26eb0c9e2d38ea51d11f741d61100223253271a084adadeb7e78c6d4e9004636f089e4273c5bf64a41bd7e9ff795317acf30531cb36aeb0d8db9304b3c8270c3
Previously an empty input argument transaction that is marked for replaceability fails to pass the
SignalsOptInRBF
check right before funding it. Explicitly check for that condition before throwing an error.The rpc call had two separate
replaceable
arguments, each of which being used in mutually exclusive places. I preserved theoptions
version to retain compatability withfundtransaction
.