Skip to content

Commit e209184

Browse files
committed
[wallet] deprecate sendfrom RPC method.
1 parent 450055b commit e209184

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,14 @@ static UniValue sendfrom(const JSONRPCRequest& request)
10171017
return NullUniValue;
10181018
}
10191019

1020+
if (!IsDeprecatedRPCEnabled("accounts")) {
1021+
if (request.fHelp) {
1022+
throw std::runtime_error("sendfrom (Deprecated, will be removed in V0.18. To use this command, start bitcoind with -deprecatedrpc=accounts)");
1023+
}
1024+
throw JSONRPCError(RPC_METHOD_DEPRECATED, "sendfrom is deprecated and will be removed in V0.18. To use this command, start bitcoind with -deprecatedrpc=accounts.");
1025+
}
1026+
1027+
10201028
if (request.fHelp || request.params.size() < 3 || request.params.size() > 6)
10211029
throw std::runtime_error(
10221030
"sendfrom \"fromaccount\" \"toaddress\" amount ( minconf \"comment\" \"comment_to\" )\n"
@@ -4376,7 +4384,6 @@ static const CRPCCommand commands[] =
43764384
{ "wallet", "listwallets", &listwallets, {} },
43774385
{ "wallet", "loadwallet", &loadwallet, {"filename"} },
43784386
{ "wallet", "lockunspent", &lockunspent, {"unlock","transactions"} },
4379-
{ "wallet", "sendfrom", &sendfrom, {"fromaccount","toaddress","amount","minconf","comment","comment_to"} },
43804387
{ "wallet", "sendmany", &sendmany, {"fromaccount|dummy","amounts","minconf","comment","subtractfeefrom","replaceable","conf_target","estimate_mode"} },
43814388
{ "wallet", "sendtoaddress", &sendtoaddress, {"address","amount","comment","comment_to","subtractfeefromamount","replaceable","conf_target","estimate_mode"} },
43824389
{ "wallet", "settxfee", &settxfee, {"amount"} },
@@ -4397,6 +4404,7 @@ static const CRPCCommand commands[] =
43974404
{ "wallet", "listaccounts", &listaccounts, {"minconf","include_watchonly"} },
43984405
{ "wallet", "listreceivedbyaccount", &listreceivedbylabel, {"minconf","include_empty","include_watchonly"} },
43994406
{ "wallet", "setaccount", &setlabel, {"address","account"} },
4407+
{ "wallet", "sendfrom", &sendfrom, {"fromaccount","toaddress","amount","minconf","comment","comment_to"} },
44004408
{ "wallet", "move", &movecmd, {"fromaccount","toaccount","amount","minconf","comment"} },
44014409

44024410
/** Label functions (to replace non-balance account functions) */

test/functional/wallet_fallbackfee.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def run_test(self):
2121
self.restart_node(0, extra_args=["-fallbackfee=0"])
2222
assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1))
2323
assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].fundrawtransaction(self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1})))
24-
assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].sendfrom("", self.nodes[0].getnewaddress(), 1))
2524
assert_raises_rpc_error(-6, "Fee estimation failed", lambda: self.nodes[0].sendmany("", {self.nodes[0].getnewaddress(): 1}))
2625

2726
if __name__ == '__main__':

test/functional/wallet_labels.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def _run_subtest(self, accounts_api, node):
8585
# we want to reset so that the "" label has what's expected.
8686
# otherwise we're off by exactly the fee amount as that's mined
8787
# and matures in the next 100 blocks
88-
node.sendfrom("", common_address, fee)
88+
if accounts_api:
89+
node.sendfrom("", common_address, fee)
8990
amount_to_send = 1.0
9091

9192
# Create labels and make sure subsequent label API calls
@@ -125,7 +126,7 @@ def _run_subtest(self, accounts_api, node):
125126
if accounts_api:
126127
node.sendfrom(label.name, to_label.receive_address, amount_to_send)
127128
else:
128-
node.sendfrom(label.name, to_label.addresses[0], amount_to_send)
129+
node.sendtoaddress(to_label.addresses[0], amount_to_send)
129130
node.generate(1)
130131
for label in labels:
131132
if accounts_api:
@@ -166,7 +167,8 @@ def _run_subtest(self, accounts_api, node):
166167
label.add_address(multisig_address)
167168
label.purpose[multisig_address] = "send"
168169
label.verify(node)
169-
node.sendfrom("", multisig_address, 50)
170+
if accounts_api:
171+
node.sendfrom("", multisig_address, 50)
170172
node.generate(101)
171173
if accounts_api:
172174
for label in labels:

0 commit comments

Comments
 (0)