Skip to content

Commit f180e81

Browse files
committed
Merge #14023: Remove accounts rpcs
bb08423 [doc] Add release notes for 'account' API removal (John Newbery) 1f4b865 [wallet] Re-sort wallet RPC commands (John Newbery) f0dc850 [wallet] Remove wallet account RPCs (John Newbery) c410f41 [tests] Remove wallet accounts test (John Newbery) Pull request description: This is the first part of #13825. It simply removes the RPC methods and tests. #13825 touches lots of files and will require frequent rebasing. Breaking it down for easier reviewing and fewer rebases. Tree-SHA512: d29af8e7a035e4484e6b9bb56cb86592be0ec112d8ba4ce19c15d15366ff3086e89e99fca26b90c9d66f6d3e06894486d0f29948df0bb7dcb1e2c49c6887a85a
2 parents 794e55b + bb08423 commit f180e81

File tree

10 files changed

+112
-1021
lines changed

10 files changed

+112
-1021
lines changed

doc/release-notes-14023.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Accout API removed
2+
------------------
3+
4+
The 'account' API was deprecated in v0.17 and has been fully removed in v0.18.
5+
The 'label' API was introduced in v0.17 as a replacement for accounts.
6+
7+
See the release notes from v0.17 for a full description of the changes from the
8+
'account' API to the 'label' API.

src/Makefile.test.include

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ BITCOIN_TESTS =\
9696

9797
if ENABLE_WALLET
9898
BITCOIN_TESTS += \
99-
wallet/test/accounting_tests.cpp \
10099
wallet/test/psbt_wallet_tests.cpp \
101100
wallet/test/wallet_tests.cpp \
102101
wallet/test/wallet_crypto_tests.cpp \

src/rpc/client.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,11 @@ static const CRPCConvertParam vRPCConvertParams[] =
4040
{ "settxfee", 0, "amount" },
4141
{ "sethdseed", 0, "newkeypool" },
4242
{ "getreceivedbyaddress", 1, "minconf" },
43-
{ "getreceivedbyaccount", 1, "minconf" },
4443
{ "getreceivedbylabel", 1, "minconf" },
4544
{ "listreceivedbyaddress", 0, "minconf" },
4645
{ "listreceivedbyaddress", 1, "include_empty" },
4746
{ "listreceivedbyaddress", 2, "include_watchonly" },
4847
{ "listreceivedbyaddress", 3, "address_filter" },
49-
{ "listreceivedbyaccount", 0, "minconf" },
50-
{ "listreceivedbyaccount", 1, "include_empty" },
51-
{ "listreceivedbyaccount", 2, "include_watchonly" },
5248
{ "listreceivedbylabel", 0, "minconf" },
5349
{ "listreceivedbylabel", 1, "include_empty" },
5450
{ "listreceivedbylabel", 2, "include_watchonly" },
@@ -59,15 +55,9 @@ static const CRPCConvertParam vRPCConvertParams[] =
5955
{ "waitforblockheight", 1, "timeout" },
6056
{ "waitforblock", 1, "timeout" },
6157
{ "waitfornewblock", 0, "timeout" },
62-
{ "move", 2, "amount" },
63-
{ "move", 3, "minconf" },
64-
{ "sendfrom", 2, "amount" },
65-
{ "sendfrom", 3, "minconf" },
6658
{ "listtransactions", 1, "count" },
6759
{ "listtransactions", 2, "skip" },
6860
{ "listtransactions", 3, "include_watchonly" },
69-
{ "listaccounts", 0, "minconf" },
70-
{ "listaccounts", 1, "include_watchonly" },
7161
{ "walletpassphrase", 1, "timeout" },
7262
{ "getblocktemplate", 0, "template_request" },
7363
{ "listsinceblock", 1, "target_confirmations" },

src/wallet/rpcdump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
11501150
" \"keys\": [\"<key>\", ... ] , (array, optional) Array of strings giving private keys whose corresponding public keys must occur in the output or redeemscript\n"
11511151
" \"internal\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be treated as not incoming payments\n"
11521152
" \"watchonly\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be considered watched even when they're not spendable, only allowed if keys are empty\n"
1153-
" \"label\": <label> , (string, optional, default: '') Label to assign to the address (aka account name, for now), only allowed with internal=false\n"
1153+
" \"label\": <label> , (string, optional, default: '') Label to assign to the address, only allowed with internal=false\n"
11541154
" }\n"
11551155
" ,...\n"
11561156
" ]\n"

src/wallet/rpcwallet.cpp

Lines changed: 82 additions & 684 deletions
Large diffs are not rendered by default.

src/wallet/test/accounting_tests.cpp

Lines changed: 0 additions & 136 deletions
This file was deleted.

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class CWalletTx : public CMerkleTx
302302
* serialized in the wallet database:
303303
*
304304
* "comment", "to" - comment strings provided to sendtoaddress,
305-
* sendfrom, sendmany wallet RPCs
305+
* and sendmany wallet RPCs
306306
* "replaces_txid" - txid (as HexStr) of transaction replaced by
307307
* bumpfee on transaction created by bumpfee
308308
* "replaced_by_txid" - txid (as HexStr) of transaction created by

test/functional/rpc_deprecated.py

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test deprecation of RPC calls."""
66
from test_framework.test_framework import BitcoinTestFramework
7-
from test_framework.util import assert_raises_rpc_error
87

98
class DeprecatedRpcTest(BitcoinTestFramework):
109
def set_test_params(self):
1110
self.num_nodes = 2
1211
self.setup_clean_chain = True
13-
self.extra_args = [[], ["-deprecatedrpc=validateaddress", "-deprecatedrpc=accounts"]]
12+
self.extra_args = [[], ["-deprecatedrpc=validateaddress"]]
1413

1514
def run_test(self):
1615
# This test should be used to verify correct behaviour of deprecated
@@ -27,82 +26,5 @@ def run_test(self):
2726
not_dep_val = self.nodes[1].validateaddress(SOME_ADDRESS)
2827
assert "ismine" in not_dep_val
2928

30-
self.log.info("Test accounts deprecation")
31-
# The following account RPC methods are deprecated:
32-
# - getaccount
33-
# - getaccountaddress
34-
# - getaddressesbyaccount
35-
# - getreceivedbyaccount
36-
# - listaccouts
37-
# - listreceivedbyaccount
38-
# - move
39-
# - setaccount
40-
#
41-
# The following 'label' RPC methods are usable both with and without the
42-
# -deprecatedrpc=accounts switch enabled.
43-
# - getaddressesbylabel
44-
# - getreceivedbylabel
45-
# - listlabels
46-
# - listreceivedbylabel
47-
# - setlabel
48-
#
49-
address0 = self.nodes[0].getnewaddress()
50-
self.nodes[0].generatetoaddress(101, address0)
51-
self.sync_all()
52-
address1 = self.nodes[1].getnewaddress()
53-
self.nodes[1].generatetoaddress(101, address1)
54-
55-
self.log.info("- getaccount")
56-
assert_raises_rpc_error(-32, "getaccount is deprecated", self.nodes[0].getaccount, address0)
57-
self.nodes[1].getaccount(address1)
58-
59-
self.log.info("- setaccount")
60-
assert_raises_rpc_error(-32, "setaccount is deprecated", self.nodes[0].setaccount, address0, "label0")
61-
self.nodes[1].setaccount(address1, "label1")
62-
63-
self.log.info("- setlabel")
64-
self.nodes[0].setlabel(address0, "label0")
65-
self.nodes[1].setlabel(address1, "label1")
66-
67-
self.log.info("- getaccountaddress")
68-
assert_raises_rpc_error(-32, "getaccountaddress is deprecated", self.nodes[0].getaccountaddress, "label0")
69-
self.nodes[1].getaccountaddress("label1")
70-
71-
self.log.info("- getaddressesbyaccount")
72-
assert_raises_rpc_error(-32, "getaddressesbyaccount is deprecated", self.nodes[0].getaddressesbyaccount, "label0")
73-
self.nodes[1].getaddressesbyaccount("label1")
74-
75-
self.log.info("- getaddressesbylabel")
76-
self.nodes[0].getaddressesbylabel("label0")
77-
self.nodes[1].getaddressesbylabel("label1")
78-
79-
self.log.info("- getreceivedbyaccount")
80-
assert_raises_rpc_error(-32, "getreceivedbyaccount is deprecated", self.nodes[0].getreceivedbyaccount, "label0")
81-
self.nodes[1].getreceivedbyaccount("label1")
82-
83-
self.log.info("- getreceivedbylabel")
84-
self.nodes[0].getreceivedbylabel("label0")
85-
self.nodes[1].getreceivedbylabel("label1")
86-
87-
self.log.info("- listaccounts")
88-
assert_raises_rpc_error(-32, "listaccounts is deprecated", self.nodes[0].listaccounts)
89-
self.nodes[1].listaccounts()
90-
91-
self.log.info("- listlabels")
92-
self.nodes[0].listlabels()
93-
self.nodes[1].listlabels()
94-
95-
self.log.info("- listreceivedbyaccount")
96-
assert_raises_rpc_error(-32, "listreceivedbyaccount is deprecated", self.nodes[0].listreceivedbyaccount)
97-
self.nodes[1].listreceivedbyaccount()
98-
99-
self.log.info("- listreceivedbylabel")
100-
self.nodes[0].listreceivedbylabel()
101-
self.nodes[1].listreceivedbylabel()
102-
103-
self.log.info("- move")
104-
assert_raises_rpc_error(-32, "move is deprecated", self.nodes[0].move, "label0", "label0b", 10)
105-
self.nodes[1].move("label1", "label1b", 10)
106-
10729
if __name__ == '__main__':
10830
DeprecatedRpcTest().main()

test/functional/wallet_address_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def test_address(self, node, address, multisig, typ):
143143
assert(False)
144144

145145
def test_change_output_type(self, node_sender, destinations, expected_type):
146-
txid = self.nodes[node_sender].sendmany(fromaccount="", amounts=dict.fromkeys(destinations, 0.001))
146+
txid = self.nodes[node_sender].sendmany(dummy="", amounts=dict.fromkeys(destinations, 0.001))
147147
raw_tx = self.nodes[node_sender].getrawtransaction(txid)
148148
tx = self.nodes[node_sender].decoderawtransaction(raw_tx)
149149

0 commit comments

Comments
 (0)