[RPC] Split signrawtransaction into wallet and non-wallet RPC command#10579
Conversation
|
Incorrect scripted diff. |
0b7c0c2 to
1283d87
Compare
|
I'm not entirely sure if this is a good long term strategy. Where are the differences between |
|
@jonasschnelli |
a1d577b to
a15695a
Compare
7725585 to
05c3cf5
Compare
|
This has missed the 0.15 feature freeze, moving to 0.16. |
|
needs rebase |
8674057 to
aea7072
Compare
|
rebased |
aea7072 to
744c9a6
Compare
jnewbery
left a comment
There was a problem hiding this comment.
Some review comments inline. It's a shame that this doesn't remove the server->wallet dependency, but it's a good first step in that direction.
I felt bad about asking you to rebase and then not actually reviewing before it got stale again, so I rebased it myself here: https://github.com/jnewbery/bitcoin/tree/pr10579 . Feel free to grab that branch if it helps.
There was a problem hiding this comment.
supernit: 1 usually comes before 2 :)
There was a problem hiding this comment.
This should be in the first commit (6fded798a77e8a754fa9455afd3328aee0842274)
There was a problem hiding this comment.
following lines aren't sorted either, not sure if it matters to clean this up
There was a problem hiding this comment.
Can you make this change before the scripted diff commit (to not break git bisect). You could change the args to be named args while you're doing that.
There was a problem hiding this comment.
no need for assert_equal(thing, True). Just use assert thing
There was a problem hiding this comment.
just use assert not thing
There was a problem hiding this comment.
suggestion: add a comment here to say that signrawtransactionwithwallet doesn't take a privkeys parameter.
There was a problem hiding this comment.
Perhaps hide this RPC behind a deprecated command line argument (similar to #11031)
There was a problem hiding this comment.
nit: I know these are moves, but there's so few of them that you might as well add braces to the ifs.
There was a problem hiding this comment.
nit: use snake_case for variables in new functions.
There was a problem hiding this comment.
nit: new function parameters should be snake_case
There was a problem hiding this comment.
Remove key asserts since below you assert the value, which fail in case the key is not defined? cc @jnewbery.
There was a problem hiding this comment.
Right. The line below should raise KeyError in that case.
There was a problem hiding this comment.
#endif // BITCOIN_RPC_RAWTRANSACTION_HThere was a problem hiding this comment.
Unknown types below: CMutableTransaction and UniValue.
There was a problem hiding this comment.
Still not addressed in f5a3e0d4a3b4b359714b7d380d7784b7ca0524c0
There was a problem hiding this comment.
Hmm. It must have gotten lost somewhere.
There was a problem hiding this comment.
Take the opportunity to kill fGood:
if (!vchSecret.SetString(k.get_str())) {There was a problem hiding this comment.
Ops, align this and above lines? 😞
181dee9 to
3808129
Compare
|
reACK 3808129837f12482fcadd030d4e720ff2498b452. Only changes are:
|
|
Not pushing! :)
…On Fri, Feb 16, 2018, 5:25 PM John Newbery ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/rpc/rawtransaction.cpp
<#10579 (comment)>:
> @@ -672,88 +672,13 @@ UniValue combinerawtransaction(const JSONRPCRequest& request)
return EncodeHexTx(mergedTx);
}
-UniValue signrawtransaction(const JSONRPCRequest& request)
+UniValue sign_transaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival, CBasicKeyStore *keystore, bool tempKeystore, const UniValue& hashType)
Please no more renames! :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10579 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFgC0xdQOxI6frA4Q39cT1VlA7ZPKX9vks5tVgBlgaJpZM4N3w_N>
.
|
Splits signrwatransaction into a wallet version (signrawtransactionwithwallet) and non-wallet version (signrawtransactionwithkey). signrawtransaction is marked as DEPRECATED and will call the right signrawtransaction* command as per the parameters in order to maintain compatibility. Updated signrawtransactions test to use new RPCs
…let in tests -BEGIN VERIFY SCRIPT- sed -i 's/\<signrawtransaction\>/signrawtransactionwithwallet/g' test/functional/*.py sed -i 's/\<signrawtransaction\>/signrawtransactionwithwallet/g' test/functional/test_framework/*.py -END VERIFY SCRIPT-
Add a brief test for signrawtransaction to ensure that compatibility is maintained.
3808129 to
d602348
Compare
|
Rebased again. |
|
re-utACK d602348 |
| #define BITCOIN_RPC_RAWTRANSACTION_H | ||
|
|
||
| class CBasicKeyStore; | ||
| class CMutableTransaction; |
There was a problem hiding this comment.
Nit, gives compiler warning:
In file included from rpc/rawtransaction.cpp:20:
./rpc/rawtransaction.h:9:1: warning: class 'CMutableTransaction' was previously declared as a struct [-Wmismatched-tags]
class CMutableTransaction;
^
./primitives/transaction.h:362:8: note: previous use is here
struct CMutableTransaction
^
./rpc/rawtransaction.h:9:1: note: did you mean struct here?
class CMutableTransaction;
^~~~~
struct
There was a problem hiding this comment.
I don't see this on my machine..
|
reACK d602348 |
|
utACK d602348 |
…et RPC command d602348 Add test for signrawtransaction (Andrew Chow) eefff65 scripted-diff: change signrawtransaction to signrawtransactionwithwallet in tests (Andrew Chow) 1e79c05 Split signrawtransaction into wallet and non-wallet (Andrew Chow) Pull request description: This PR is part of #10570. It also builds on top of #10571. This PR splits `signrawtransaction` into two commands, `signrawtransactionwithkey` and `signrawtransactionwithwallet`. `signrawtransactionwithkey` requires private keys to be passed in and does not use the wallet for any signing. `signrawtransactionwithwallet` uses the wallet to sign a raw transaction and does not have any parameters to take private keys. The `signrawtransaction` RPC has been marked as deprecated and will call the appropriate RPC command based upon the parameters given. A test was added to check this behavior is still consistent with the original behavior. All tests that used `signrawtransaction` have been updated to use one of the two new RPCs. Most uses were changed to `signrawtransactionwithwallet`. These were changed via a scripted diff. Tree-SHA512: d0adf5b4cd7077639c504ec07bee262a3b94658d34db0a5c86a263b6393f7aa62f45129eafe29a7c861aa58440dd19348ee0c8b685e8a62d6f4adae8ec8f8cb3
eacc5b2 Declare CMutableTransaction a struct in rawtransaction.h (Ben Woosley) Pull request description: Because it's a struct. Fix for #10579 - this was called out in code review. #10579 (comment) Tree-SHA512: 10758a667218481de6f50b5ed874e92eb350c621f7a6355fba7da6ab42b09e1764f827e89491c8663e554fcfd23f124b299f968237c6ad1ff7819e211bd7e521
…on-wallet RPC command d602348 Add test for signrawtransaction (Andrew Chow) eefff65 scripted-diff: change signrawtransaction to signrawtransactionwithwallet in tests (Andrew Chow) 1e79c05 Split signrawtransaction into wallet and non-wallet (Andrew Chow) Pull request description: This PR is part of bitcoin#10570. It also builds on top of bitcoin#10571. This PR splits `signrawtransaction` into two commands, `signrawtransactionwithkey` and `signrawtransactionwithwallet`. `signrawtransactionwithkey` requires private keys to be passed in and does not use the wallet for any signing. `signrawtransactionwithwallet` uses the wallet to sign a raw transaction and does not have any parameters to take private keys. The `signrawtransaction` RPC has been marked as deprecated and will call the appropriate RPC command based upon the parameters given. A test was added to check this behavior is still consistent with the original behavior. All tests that used `signrawtransaction` have been updated to use one of the two new RPCs. Most uses were changed to `signrawtransactionwithwallet`. These were changed via a scripted diff. Tree-SHA512: d0adf5b4cd7077639c504ec07bee262a3b94658d34db0a5c86a263b6393f7aa62f45129eafe29a7c861aa58440dd19348ee0c8b685e8a62d6f4adae8ec8f8cb3
Signed-off-by: pasta <pasta@dashboost.org>
…action.h eacc5b2 Declare CMutableTransaction a struct in rawtransaction.h (Ben Woosley) Pull request description: Because it's a struct. Fix for bitcoin#10579 - this was called out in code review. bitcoin#10579 (comment) Tree-SHA512: 10758a667218481de6f50b5ed874e92eb350c621f7a6355fba7da6ab42b09e1764f827e89491c8663e554fcfd23f124b299f968237c6ad1ff7819e211bd7e521
This PR is part of #10570. It also builds on top of #10571.
This PR splits
signrawtransactioninto two commands,signrawtransactionwithkeyandsignrawtransactionwithwallet.signrawtransactionwithkeyrequires private keys to be passed in and does not use the wallet for any signing.signrawtransactionwithwalletuses the wallet to sign a raw transaction and does not have any parameters to take private keys.The
signrawtransactionRPC has been marked as deprecated and will call the appropriate RPC command based upon the parameters given. A test was added to check this behavior is still consistent with the original behavior.All tests that used
signrawtransactionhave been updated to use one of the two new RPCs. Most uses were changed tosignrawtransactionwithwallet. These were changed via a scripted diff.