Skip to content

Commit

Permalink
Merge #14023: Remove accounts rpcs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
laanwj committed Aug 27, 2018
2 parents 794e55b + bb08423 commit f180e81
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 1,021 deletions.
8 changes: 8 additions & 0 deletions doc/release-notes-14023.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Accout API removed
------------------

The 'account' API was deprecated in v0.17 and has been fully removed in v0.18.
The 'label' API was introduced in v0.17 as a replacement for accounts.

See the release notes from v0.17 for a full description of the changes from the
'account' API to the 'label' API.
1 change: 0 additions & 1 deletion src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ BITCOIN_TESTS =\

if ENABLE_WALLET
BITCOIN_TESTS += \
wallet/test/accounting_tests.cpp \
wallet/test/psbt_wallet_tests.cpp \
wallet/test/wallet_tests.cpp \
wallet/test/wallet_crypto_tests.cpp \
Expand Down
10 changes: 0 additions & 10 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "settxfee", 0, "amount" },
{ "sethdseed", 0, "newkeypool" },
{ "getreceivedbyaddress", 1, "minconf" },
{ "getreceivedbyaccount", 1, "minconf" },
{ "getreceivedbylabel", 1, "minconf" },
{ "listreceivedbyaddress", 0, "minconf" },
{ "listreceivedbyaddress", 1, "include_empty" },
{ "listreceivedbyaddress", 2, "include_watchonly" },
{ "listreceivedbyaddress", 3, "address_filter" },
{ "listreceivedbyaccount", 0, "minconf" },
{ "listreceivedbyaccount", 1, "include_empty" },
{ "listreceivedbyaccount", 2, "include_watchonly" },
{ "listreceivedbylabel", 0, "minconf" },
{ "listreceivedbylabel", 1, "include_empty" },
{ "listreceivedbylabel", 2, "include_watchonly" },
Expand All @@ -59,15 +55,9 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "waitforblockheight", 1, "timeout" },
{ "waitforblock", 1, "timeout" },
{ "waitfornewblock", 0, "timeout" },
{ "move", 2, "amount" },
{ "move", 3, "minconf" },
{ "sendfrom", 2, "amount" },
{ "sendfrom", 3, "minconf" },
{ "listtransactions", 1, "count" },
{ "listtransactions", 2, "skip" },
{ "listtransactions", 3, "include_watchonly" },
{ "listaccounts", 0, "minconf" },
{ "listaccounts", 1, "include_watchonly" },
{ "walletpassphrase", 1, "timeout" },
{ "getblocktemplate", 0, "template_request" },
{ "listsinceblock", 1, "target_confirmations" },
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpcdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
" \"keys\": [\"<key>\", ... ] , (array, optional) Array of strings giving private keys whose corresponding public keys must occur in the output or redeemscript\n"
" \"internal\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be treated as not incoming payments\n"
" \"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"
" \"label\": <label> , (string, optional, default: '') Label to assign to the address (aka account name, for now), only allowed with internal=false\n"
" \"label\": <label> , (string, optional, default: '') Label to assign to the address, only allowed with internal=false\n"
" }\n"
" ,...\n"
" ]\n"
Expand Down
766 changes: 82 additions & 684 deletions src/wallet/rpcwallet.cpp

Large diffs are not rendered by default.

136 changes: 0 additions & 136 deletions src/wallet/test/accounting_tests.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class CWalletTx : public CMerkleTx
* serialized in the wallet database:
*
* "comment", "to" - comment strings provided to sendtoaddress,
* sendfrom, sendmany wallet RPCs
* and sendmany wallet RPCs
* "replaces_txid" - txid (as HexStr) of transaction replaced by
* bumpfee on transaction created by bumpfee
* "replaced_by_txid" - txid (as HexStr) of transaction created by
Expand Down
80 changes: 1 addition & 79 deletions test/functional/rpc_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_raises_rpc_error

class DeprecatedRpcTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
self.extra_args = [[], ["-deprecatedrpc=validateaddress", "-deprecatedrpc=accounts"]]
self.extra_args = [[], ["-deprecatedrpc=validateaddress"]]

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

self.log.info("Test accounts deprecation")
# The following account RPC methods are deprecated:
# - getaccount
# - getaccountaddress
# - getaddressesbyaccount
# - getreceivedbyaccount
# - listaccouts
# - listreceivedbyaccount
# - move
# - setaccount
#
# The following 'label' RPC methods are usable both with and without the
# -deprecatedrpc=accounts switch enabled.
# - getaddressesbylabel
# - getreceivedbylabel
# - listlabels
# - listreceivedbylabel
# - setlabel
#
address0 = self.nodes[0].getnewaddress()
self.nodes[0].generatetoaddress(101, address0)
self.sync_all()
address1 = self.nodes[1].getnewaddress()
self.nodes[1].generatetoaddress(101, address1)

self.log.info("- getaccount")
assert_raises_rpc_error(-32, "getaccount is deprecated", self.nodes[0].getaccount, address0)
self.nodes[1].getaccount(address1)

self.log.info("- setaccount")
assert_raises_rpc_error(-32, "setaccount is deprecated", self.nodes[0].setaccount, address0, "label0")
self.nodes[1].setaccount(address1, "label1")

self.log.info("- setlabel")
self.nodes[0].setlabel(address0, "label0")
self.nodes[1].setlabel(address1, "label1")

self.log.info("- getaccountaddress")
assert_raises_rpc_error(-32, "getaccountaddress is deprecated", self.nodes[0].getaccountaddress, "label0")
self.nodes[1].getaccountaddress("label1")

self.log.info("- getaddressesbyaccount")
assert_raises_rpc_error(-32, "getaddressesbyaccount is deprecated", self.nodes[0].getaddressesbyaccount, "label0")
self.nodes[1].getaddressesbyaccount("label1")

self.log.info("- getaddressesbylabel")
self.nodes[0].getaddressesbylabel("label0")
self.nodes[1].getaddressesbylabel("label1")

self.log.info("- getreceivedbyaccount")
assert_raises_rpc_error(-32, "getreceivedbyaccount is deprecated", self.nodes[0].getreceivedbyaccount, "label0")
self.nodes[1].getreceivedbyaccount("label1")

self.log.info("- getreceivedbylabel")
self.nodes[0].getreceivedbylabel("label0")
self.nodes[1].getreceivedbylabel("label1")

self.log.info("- listaccounts")
assert_raises_rpc_error(-32, "listaccounts is deprecated", self.nodes[0].listaccounts)
self.nodes[1].listaccounts()

self.log.info("- listlabels")
self.nodes[0].listlabels()
self.nodes[1].listlabels()

self.log.info("- listreceivedbyaccount")
assert_raises_rpc_error(-32, "listreceivedbyaccount is deprecated", self.nodes[0].listreceivedbyaccount)
self.nodes[1].listreceivedbyaccount()

self.log.info("- listreceivedbylabel")
self.nodes[0].listreceivedbylabel()
self.nodes[1].listreceivedbylabel()

self.log.info("- move")
assert_raises_rpc_error(-32, "move is deprecated", self.nodes[0].move, "label0", "label0b", 10)
self.nodes[1].move("label1", "label1b", 10)

if __name__ == '__main__':
DeprecatedRpcTest().main()
2 changes: 1 addition & 1 deletion test/functional/wallet_address_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_address(self, node, address, multisig, typ):
assert(False)

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

Expand Down
Loading

0 comments on commit f180e81

Please sign in to comment.