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
Implement watchonly for fundrawtransaction #5524
Conversation
That was quick. Maybe it makes more sense to reopen this pull when #5503 is stable and got ACK and merged. I prefer to have a easy reviewable code-pice because reviewing and testing is the bottleneck. |
034b854
to
25e83c2
Compare
Breaks travis. |
59d167d
to
cd51e3e
Compare
Tests are passing now. |
cd51e3e
to
3ce454f
Compare
- fix typo - fix RPCTypeCheck for fundrawtransaction
Support watchonly in fundrawtransaction, CreateTransaction, SelectCoins and coin selection in general. Coin selection is exposed over RPC through fundrawtransaction, and watchonly can be enabled by passing includeWatching true (defaults to false). fundrawtransaction will first attempt to fund a transaction without using watchonly, even when includeWatching is enabled. When this fails, an includeWatching attempt is made. When an includeWatching attempt at coin selection is performed (in CreateTransaction), and all watchonlys are consumed leaving no funds available for a fee, then CreateTransaction will not include a fee in the transaction. Also, includeWatching tests (for fundrawtransaction). See also: bitcoin#5503
3ce454f
to
a3af4c1
Compare
Rebased on to the fundrawtransaction branch. Travis is reporting an error:
|
+ HelpExampleRpc("sendrawtransaction", "\"signedhex\"") | ||
); | ||
|
||
RPCTypeCheck(params, boost::assign::list_of(int_type)(int_type)(array_type)); |
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 probably be RPCTypeCheck(params, boost::assign::list_of(str_type)(bool_type));
.
Why try to fund without watchonly first? If I call the RPC and say I want to include watchonly, it means I want to include watchonly (and get the best fee from the inputs I opted to select). |
I'd like to add this to #5503 but the nFeeRet=0 as well as the issue mentioned by @TheBlueMatt (calling |
Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524).
Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524).
Closed in favor of #6088. |
Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524).
- backports bitcoin/bitcoin@6bdb474 Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524). - backports bitcoin/bitcoin@d042854 [squash commit]
- backports bitcoin/bitcoin@6bdb474 Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524). - backports bitcoin/bitcoin@d042854 [squash commit]
- backports bitcoin/bitcoin@6bdb474 Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524). - backports bitcoin/bitcoin@d042854 [squash commit]
- backports bitcoin/bitcoin@6bdb474 Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524). - backports bitcoin/bitcoin@d042854 [squash commit]
- backports bitcoin/bitcoin@6bdb474 Some code and test cases stolen from Bryan Bishop <bryan@ledgerx.com> (pull bitcoin#5524). - backports bitcoin/bitcoin@d042854 [squash commit]
Support watchonly in fundrawtransaction, CreateTransaction, SelectCoins and coin selection in general.
Coin selection is exposed over RPC through fundrawtransaction, and watchonly can be enabled by passing includeWatching true (defaults to false).
fundrawtransaction will first attempt to fund a transaction without using watchonly, even when includeWatching is enabled. When this fails, an includeWatching attempt is made.
When an includeWatching attempt at coin selection is performed (in CreateTransaction), and all watchonlys are consumed leaving no funds available for a fee, then CreateTransaction will not include a fee in the transaction.
Also, includeWatching tests (for fundrawtransaction) added here are passing.
Reviewers! Here are some things I would especially appreciate eyelooking for: suggestions for more edge cases for the tests, other RPC commands that should be tested, other tests for other features that I should double check for whether or not this makes any impacts, locations or existence of any sort of documentation I should be updating, unintended side effects introduced in CreateTransaction like by multiple parameters that may eventually be used simultaneously in ways that I am failing to anticipate....
I received a few suggestions from others that SignSignature should be replaced with an estimator in CreateTransaction. However, this estimator apparently does not seem to be necessary for implementing watchonly-support here, so this suggestion may go into another ticket instead.
This requires #5503 to be merged (I wouldn't mind this getting merged into #5503).