Skip to content

Conversation

instagibbs
Copy link
Member

@instagibbs instagibbs commented Aug 14, 2018

  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.

Copy link
Member

@achow101 achow101 left a 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.

@@ -4715,10 +4714,16 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
}, true
);


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: miscellaneous whitespace change

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);
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

derp

if (!request.params[3].isNull()){
params_copy.pushKV("replaceable", request.params[3].get_bool());
}
FundTransaction(pwallet, rawTx, fee, change_position, params_copy[4]);
Copy link
Member

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].

// 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());
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

@instagibbs
Copy link
Member Author

reworked to preseve the options replaceable instead

@instagibbs
Copy link
Member Author

pushed basic functional test

@instagibbs
Copy link
Member Author

I'll note that when locktime == 0, ConstructTransaction adding inputs and FundTransaction adding inputs acts differently: The former does CTxIn::SEQUENCE_FINAL while the latter does CTxIn::SEQUENCE_FINAL-1. This is kind of weird and probably a fingerprint.

@instagibbs
Copy link
Member Author

Can I get 0.17 backport tag? This is a bugfix.

@fanquake fanquake added this to the 0.17.0 milestone Aug 17, 2018
@instagibbs
Copy link
Member Author

instagibbs commented Aug 19, 2018 via email

@promag
Copy link
Contributor

promag commented Aug 19, 2018

? Isn't 0.17 the first release with PSBT?

Yes, does that matter?

@sipa
Copy link
Member

sipa commented Aug 19, 2018

So it's not in a release yet?

@promag
Copy link
Contributor

promag commented Aug 19, 2018

🤦‍♂️ it's not released..

Copy link
Contributor

@promag promag left a 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.

@instagibbs
Copy link
Member Author

Looks like we're also missing the arg type check for the bip32derivs arg, pushed a fix for that.

@DrahtBot
Copy link
Contributor

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.

@achow101
Copy link
Member

utACK faaac5c

1 similar comment
@laanwj
Copy link
Member

laanwj commented Aug 21, 2018

utACK faaac5c

@laanwj laanwj merged commit faaac5c into bitcoin:master Aug 21, 2018
laanwj added a commit that referenced this pull request Aug 21, 2018
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
laanwj pushed a commit that referenced this pull request Aug 21, 2018
Github-Pull: #13968
Rebased-From: 2252ec5
Tree-SHA512: 1f9978ee25fbe9bb338af19d81b401fa531d314ac8288cdb21c1bf10459edea50b43e2d5e97c9bb5fe24c8db89363f8233c0a3d96066ed85f7bd6d2eb234aac0
laanwj pushed a commit that referenced this pull request Aug 21, 2018
Github-Pull: #13968
Rebased-From: 1f18d7b
Tree-SHA512: 90391703181db6880a135c60aca792a9e92c4abcad26907cd6cb0a0378593fe45cf995a22ae142ea7de2767c72a9df444e918ff15e460ce19c0435163917d812
laanwj pushed a commit that referenced this pull request Aug 21, 2018
Github-Pull: #13968
Rebased-From: 1f0c428
Tree-SHA512: 1f8b10629a314f623d589801ef2e62724de2cd82a0e523e0ab25a285f92b76a3b31304c1c0418b1b611ec3ca0016016d1e6af410ac81a78449b875c4f89a46d7
laanwj pushed a commit that referenced this pull request Aug 21, 2018
Github-Pull: #13968
Rebased-From: faaac5c
Tree-SHA512: 758c0c3e4435897d1a9b03ea93f1b2a1a1b64071eda9450f968acf537c172ee61acf9d962bc22ddb6de26e0ad39d9165cdee6f260bb5a95bf97b4003853f0874
laanwj added a commit that referenced this pull request Aug 28, 2018
61fe653 fix walletcreatefundedpsbt deriv paths, add test (Gregory Sanders)

Pull request description:

  Added the regression in #13968

Tree-SHA512: a31290b57ed80a8486925e562ca5412500d4215a238de7e448f48edfa671c87aebd79ee179a8340b289d9811ae6fa30ef75eefd5f5890fb6285174c5db72ff65
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Sep 14, 2018
Github-Pull: bitcoin#13968
Rebased-From: 2252ec5
Tree-SHA512: 1f9978ee25fbe9bb338af19d81b401fa531d314ac8288cdb21c1bf10459edea50b43e2d5e97c9bb5fe24c8db89363f8233c0a3d96066ed85f7bd6d2eb234aac0
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Sep 14, 2018
Github-Pull: bitcoin#13968
Rebased-From: 1f18d7b
Tree-SHA512: 90391703181db6880a135c60aca792a9e92c4abcad26907cd6cb0a0378593fe45cf995a22ae142ea7de2767c72a9df444e918ff15e460ce19c0435163917d812
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Sep 14, 2018
Github-Pull: bitcoin#13968
Rebased-From: 1f0c428
Tree-SHA512: 1f8b10629a314f623d589801ef2e62724de2cd82a0e523e0ab25a285f92b76a3b31304c1c0418b1b611ec3ca0016016d1e6af410ac81a78449b875c4f89a46d7
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Sep 14, 2018
Github-Pull: bitcoin#13968
Rebased-From: faaac5c
Tree-SHA512: 758c0c3e4435897d1a9b03ea93f1b2a1a1b64071eda9450f968acf537c172ee61acf9d962bc22ddb6de26e0ad39d9165cdee6f260bb5a95bf97b4003853f0874
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Sep 8, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants