27
27
#include < txmempool.h>
28
28
#include < uint256.h>
29
29
#include < utilstrencodings.h>
30
- #ifdef ENABLE_WALLET
31
- #include < wallet/rpcwallet.h>
32
- #endif
33
30
34
31
#include < future>
35
32
#include < stdint.h>
@@ -824,8 +821,7 @@ UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival
824
821
view.AddCoin (out, std::move (newcoin), true );
825
822
}
826
823
827
- // if redeemScript given and not using the local wallet (private keys
828
- // given), add redeemScript to the keystore so it can be signed:
824
+ // if redeemScript and private keys were given, add redeemScript to the keystore so it can be signed
829
825
if (is_temp_keystore && (scriptPubKey.IsPayToScriptHash () || scriptPubKey.IsPayToWitnessScriptHash ())) {
830
826
RPCTypeCheckObj (prevOut,
831
827
{
@@ -980,102 +976,10 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
980
976
981
977
UniValue signrawtransaction (const JSONRPCRequest& request)
982
978
{
983
- #ifdef ENABLE_WALLET
984
- std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest (request);
985
- CWallet* const pwallet = wallet.get ();
986
- #endif
987
-
988
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 4 )
989
- throw std::runtime_error (
990
- " signrawtransaction \" hexstring\" ( [{\" txid\" :\" id\" ,\" vout\" :n,\" scriptPubKey\" :\" hex\" ,\" redeemScript\" :\" hex\" },...] [\" privatekey1\" ,...] sighashtype )\n "
991
- " \n DEPRECATED. Sign inputs for raw transaction (serialized, hex-encoded).\n "
992
- " The second optional argument (may be null) is an array of previous transaction outputs that\n "
993
- " this transaction depends on but may not yet be in the block chain.\n "
994
- " The third optional argument (may be null) is an array of base58-encoded private\n "
995
- " keys that, if given, will be the only keys used to sign the transaction.\n "
996
- #ifdef ENABLE_WALLET
997
- + HelpRequiringPassphrase (pwallet) + " \n "
998
- #endif
999
- " \n Arguments:\n "
1000
- " 1. \" hexstring\" (string, required) The transaction hex string\n "
1001
- " 2. \" prevtxs\" (string, optional) An json array of previous dependent transaction outputs\n "
1002
- " [ (json array of json objects, or 'null' if none provided)\n "
1003
- " {\n "
1004
- " \" txid\" :\" id\" , (string, required) The transaction id\n "
1005
- " \" vout\" :n, (numeric, required) The output number\n "
1006
- " \" scriptPubKey\" : \" hex\" , (string, required) script key\n "
1007
- " \" redeemScript\" : \" hex\" , (string, required for P2SH or P2WSH) redeem script\n "
1008
- " \" amount\" : value (numeric, required) The amount spent\n "
1009
- " }\n "
1010
- " ,...\n "
1011
- " ]\n "
1012
- " 3. \" privkeys\" (string, optional) A json array of base58-encoded private keys for signing\n "
1013
- " [ (json array of strings, or 'null' if none provided)\n "
1014
- " \" privatekey\" (string) private key in base58-encoding\n "
1015
- " ,...\n "
1016
- " ]\n "
1017
- " 4. \" sighashtype\" (string, optional, default=ALL) The signature hash type. Must be one of\n "
1018
- " \" ALL\"\n "
1019
- " \" NONE\"\n "
1020
- " \" SINGLE\"\n "
1021
- " \" ALL|ANYONECANPAY\"\n "
1022
- " \" NONE|ANYONECANPAY\"\n "
1023
- " \" SINGLE|ANYONECANPAY\"\n "
1024
-
1025
- " \n Result:\n "
1026
- " {\n "
1027
- " \" hex\" : \" value\" , (string) The hex-encoded raw transaction with signature(s)\n "
1028
- " \" complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n "
1029
- " \" errors\" : [ (json array of objects) Script verification errors (if there are any)\n "
1030
- " {\n "
1031
- " \" txid\" : \" hash\" , (string) The hash of the referenced, previous transaction\n "
1032
- " \" vout\" : n, (numeric) The index of the output to spent and used as input\n "
1033
- " \" scriptSig\" : \" hex\" , (string) The hex-encoded signature script\n "
1034
- " \" sequence\" : n, (numeric) Script sequence number\n "
1035
- " \" error\" : \" text\" (string) Verification or signing error related to the input\n "
1036
- " }\n "
1037
- " ,...\n "
1038
- " ]\n "
1039
- " }\n "
1040
-
1041
- " \n Examples:\n "
1042
- + HelpExampleCli (" signrawtransaction" , " \" myhex\" " )
1043
- + HelpExampleRpc (" signrawtransaction" , " \" myhex\" " )
1044
- );
1045
-
1046
- if (!IsDeprecatedRPCEnabled (" signrawtransaction" )) {
1047
- throw JSONRPCError (RPC_METHOD_DEPRECATED, " signrawtransaction is deprecated and will be fully removed in v0.18. "
1048
- " To use signrawtransaction in v0.17, restart bitcoind with -deprecatedrpc=signrawtransaction.\n "
1049
- " Projects should transition to using signrawtransactionwithkey and signrawtransactionwithwallet before upgrading to v0.18" );
1050
- }
1051
-
1052
- RPCTypeCheck (request.params , {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true );
1053
-
1054
- // Make a JSONRPCRequest to pass on to the right signrawtransaction* command
1055
- JSONRPCRequest new_request;
1056
- new_request.id = request.id ;
1057
- new_request.params .setArray ();
1058
-
1059
- // For signing with private keys
1060
- if (!request.params [2 ].isNull ()) {
1061
- new_request.params .push_back (request.params [0 ]);
1062
- // Note: the prevtxs and privkeys are reversed for signrawtransactionwithkey
1063
- new_request.params .push_back (request.params [2 ]);
1064
- new_request.params .push_back (request.params [1 ]);
1065
- new_request.params .push_back (request.params [3 ]);
1066
- return signrawtransactionwithkey (new_request);
1067
- } else {
1068
- #ifdef ENABLE_WALLET
1069
- // Otherwise sign with the wallet which does not take a privkeys parameter
1070
- new_request.params .push_back (request.params [0 ]);
1071
- new_request.params .push_back (request.params [1 ]);
1072
- new_request.params .push_back (request.params [3 ]);
1073
- return signrawtransactionwithwallet (new_request);
1074
- #else
1075
- // If we have made it this far, then wallet is disabled and no private keys were given, so fail here.
1076
- throw JSONRPCError (RPC_INVALID_PARAMETER, " No private keys available." );
1077
- #endif
1078
- }
979
+ // This method should be removed entirely in V0.19, along with the entries in the
980
+ // CRPCCommand table and rpc/client.cpp.
981
+ throw JSONRPCError (RPC_METHOD_DEPRECATED, " signrawtransaction was removed in v0.18.\n "
982
+ " Clients should transition to using signrawtransactionwithkey and signrawtransactionwithwallet" );
1079
983
}
1080
984
1081
985
static UniValue sendrawtransaction (const JSONRPCRequest& request)
@@ -1084,7 +988,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
1084
988
throw std::runtime_error (
1085
989
" sendrawtransaction \" hexstring\" ( allowhighfees )\n "
1086
990
" \n Submits raw transaction (serialized, hex-encoded) to local node and network.\n "
1087
- " \n Also see createrawtransaction and signrawtransaction calls.\n "
991
+ " \n Also see createrawtransaction and signrawtransactionwithkey calls.\n "
1088
992
" \n Arguments:\n "
1089
993
" 1. \" hexstring\" (string, required) The hex string of the raw transaction)\n "
1090
994
" 2. allowhighfees (boolean, optional, default=false) Allow high fees\n "
@@ -1094,7 +998,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
1094
998
" \n Create a transaction\n "
1095
999
+ HelpExampleCli (" createrawtransaction" , " \" [{\\\" txid\\\" : \\\" mytxid\\\" ,\\\" vout\\\" :0}]\" \" {\\\" myaddress\\\" :0.01}\" " ) +
1096
1000
" Sign the transaction, and get back the hex\n "
1097
- + HelpExampleCli (" signrawtransaction " , " \" myhex\" " ) +
1001
+ + HelpExampleCli (" signrawtransactionwithwallet " , " \" myhex\" " ) +
1098
1002
" \n Send the transaction (signed hex)\n "
1099
1003
+ HelpExampleCli (" sendrawtransaction" , " \" signedhex\" " ) +
1100
1004
" \n As a json rpc call\n "
@@ -1199,7 +1103,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
1199
1103
" \n Create a transaction\n "
1200
1104
+ HelpExampleCli (" createrawtransaction" , " \" [{\\\" txid\\\" : \\\" mytxid\\\" ,\\\" vout\\\" :0}]\" \" {\\\" myaddress\\\" :0.01}\" " ) +
1201
1105
" Sign the transaction, and get back the hex\n "
1202
- + HelpExampleCli (" signrawtransaction " , " \" myhex\" " ) +
1106
+ + HelpExampleCli (" signrawtransactionwithwallet " , " \" myhex\" " ) +
1203
1107
" \n Test acceptance of the transaction (signed hex)\n "
1204
1108
+ HelpExampleCli (" testmempoolaccept" , " \" signedhex\" " ) +
1205
1109
" \n As a json rpc call\n "
@@ -1808,7 +1712,7 @@ static const CRPCCommand commands[] =
1808
1712
{ " rawtransactions" , " decodescript" , &decodescript, {" hexstring" } },
1809
1713
{ " rawtransactions" , " sendrawtransaction" , &sendrawtransaction, {" hexstring" ," allowhighfees" } },
1810
1714
{ " rawtransactions" , " combinerawtransaction" , &combinerawtransaction, {" txs" } },
1811
- { " rawtransactions " , " signrawtransaction" , &signrawtransaction, {" hexstring" ," prevtxs" ," privkeys" ," sighashtype" } }, /* uses wallet if enabled */
1715
+ { " hidden " , " signrawtransaction" , &signrawtransaction, {" hexstring" ," prevtxs" ," privkeys" ," sighashtype" } },
1812
1716
{ " rawtransactions" , " signrawtransactionwithkey" , &signrawtransactionwithkey, {" hexstring" ," privkeys" ," prevtxs" ," sighashtype" } },
1813
1717
{ " rawtransactions" , " testmempoolaccept" , &testmempoolaccept, {" rawtxs" ," allowhighfees" } },
1814
1718
{ " rawtransactions" , " decodepsbt" , &decodepsbt, {" psbt" } },
0 commit comments