Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 131 additions & 80 deletions src/wallet/rpcwallet.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/functional/fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def run_test(self):
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
fundedTx = self.nodes[0].fundrawtransaction(rawtx)
#create same transaction over sendtoaddress
txId = self.nodes[0].sendmany("", outputs)
txId = self.nodes[0].sendmany(outputs)
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']

#compare fee
Expand Down Expand Up @@ -518,7 +518,7 @@ def run_test(self):
fundedTx = self.nodes[1].fundrawtransaction(rawtx)

#create same transaction over sendtoaddress
txId = self.nodes[1].sendmany("", outputs)
txId = self.nodes[1].sendmany(outputs)
signedFee = self.nodes[1].getrawmempool(True)[txId]['fee']

#compare fee
Expand Down
2 changes: 1 addition & 1 deletion test/functional/import-rescan.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def set_test_params(self):
self.num_nodes = 2 + len(IMPORT_NODES)

def setup_network(self):
extra_args = [[] for _ in range(self.num_nodes)]
extra_args = [["-deprecatedrpc=accounts"] for _ in range(self.num_nodes)]
for i, import_node in enumerate(IMPORT_NODES, 2):
if import_node.prune:
extra_args[i] += ["-prune=1"]
Expand Down
1 change: 1 addition & 0 deletions test/functional/importprunedfunds.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
self.extra_args = [[], ["-deprecatedrpc=accounts"]]

def run_test(self):
self.log.info("Mining blocks...")
Expand Down
1 change: 1 addition & 0 deletions test/functional/listtransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ListTransactionsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.enable_mocktime()
self.extra_args = [["-deprecatedrpc=accounts"], ["-deprecatedrpc=accounts"]]

def run_test(self):
# Simple send, 0 to 1:
Expand Down
48 changes: 3 additions & 45 deletions test/functional/receivedby.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ def run_test(self):
self.sync_all()
assert_array_result(self.nodes[1].listreceivedbyaddress(),
{"address": addr},
{"address": addr, "account": "", "amount": Decimal("0.1"), "confirmations": 10, "txids": [txid, ]})
{"address": addr, "amount": Decimal("0.1"), "confirmations": 10, "txids": [txid, ]})
# With min confidence < 10
assert_array_result(self.nodes[1].listreceivedbyaddress(5),
{"address": addr},
{"address": addr, "account": "", "amount": Decimal("0.1"), "confirmations": 10, "txids": [txid, ]})
{"address": addr, "amount": Decimal("0.1"), "confirmations": 10, "txids": [txid, ]})
# With min confidence > 10, should not find Tx
assert_array_result(self.nodes[1].listreceivedbyaddress(11), {"address": addr}, {}, True)

# Empty Tx
addr = self.nodes[1].getnewaddress()
assert_array_result(self.nodes[1].listreceivedbyaddress(0, True),
{"address": addr},
{"address": addr, "account": "", "amount": 0, "confirmations": 0, "txids": []})
{"address": addr, "amount": 0, "confirmations": 0, "txids": []})

self.log.info("getreceivedbyaddress Test")

Expand All @@ -74,47 +74,5 @@ def run_test(self):
# Trying to getreceivedby for an address the wallet doesn't own should return an error
assert_raises_rpc_error(-4, "Address not found in wallet", self.nodes[0].getreceivedbyaddress, addr)

self.log.info("listreceivedbyaccount + getreceivedbyaccount Test")

# set pre-state
addrArr = self.nodes[1].getnewaddress()
account = self.nodes[1].getaccount(addrArr)
received_by_account_json = [r for r in self.nodes[1].listreceivedbyaccount() if r["account"] == account][0]
balance_by_account = self.nodes[1].getreceivedbyaccount(account)

txid = self.nodes[0].sendtoaddress(addr, 0.1)
self.sync_all()

# listreceivedbyaccount should return received_by_account_json because of 0 confirmations
assert_array_result(self.nodes[1].listreceivedbyaccount(),
{"account": account},
received_by_account_json)

# getreceivedbyaddress should return same balance because of 0 confirmations
balance = self.nodes[1].getreceivedbyaccount(account)
assert_equal(balance, balance_by_account)

self.nodes[1].generate(10)
self.sync_all()
# listreceivedbyaccount should return updated account balance
assert_array_result(self.nodes[1].listreceivedbyaccount(),
{"account": account},
{"account": received_by_account_json["account"], "amount": (received_by_account_json["amount"] + Decimal("0.1"))})

# getreceivedbyaddress should return updates balance
balance = self.nodes[1].getreceivedbyaccount(account)
assert_equal(balance, balance_by_account + Decimal("0.1"))

# Create a new account named "mynewaccount" that has a 0 balance
self.nodes[1].getaccountaddress("mynewaccount")
received_by_account_json = [r for r in self.nodes[1].listreceivedbyaccount(0, True) if r["account"] == "mynewaccount"][0]

# Test includeempty of listreceivedbyaccount
assert_equal(received_by_account_json["amount"], Decimal("0.0"))

# Test getreceivedbyaccount for 0 amount accounts
balance = self.nodes[1].getreceivedbyaccount("mynewaccount")
assert_equal(balance, Decimal("0.0"))

if __name__ == '__main__':
ReceivedByTest().main()
4 changes: 2 additions & 2 deletions test/functional/segwit.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,13 @@ def run_test(self):
txid = self.nodes[1].sendrawtransaction(rawtxfund)

assert_equal(self.nodes[1].gettransaction(txid, True)["txid"], txid)
assert_equal(self.nodes[1].listtransactions("*", 1, 0, True)[0]["txid"], txid)
assert_equal(self.nodes[1].listtransactions(1, 0, True)[0]["txid"], txid)

# Assert it is properly saved
self.stop_node(1)
self.start_node(1)
assert_equal(self.nodes[1].gettransaction(txid, True)["txid"], txid)
assert_equal(self.nodes[1].listtransactions("*", 1, 0, True)[0]["txid"], txid)
assert_equal(self.nodes[1].listtransactions(1, 0, True)[0]["txid"], txid)

def mine_and_test_listunspent(self, script_list, ismine):
utxo = find_unspent(self.nodes[0], 50)
Expand Down
1 change: 1 addition & 0 deletions test/functional/txn_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class TxnMallTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.extra_args = [["-deprecatedrpc=accounts"], ["-deprecatedrpc=accounts"], ["-deprecatedrpc=accounts"], ["-deprecatedrpc=accounts"]]

def add_options(self, parser):
parser.add_option("--mineblock", dest="mine_block", default=False, action="store_true",
Expand Down
1 change: 1 addition & 0 deletions test/functional/txn_doublespend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class TxnMallTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.extra_args = [["-deprecatedrpc=accounts"], ["-deprecatedrpc=accounts"], ["-deprecatedrpc=accounts"], ["-deprecatedrpc=accounts"]]

def add_options(self, parser):
parser.add_option("--mineblock", dest="mine_block", default=False, action="store_true",
Expand Down
2 changes: 1 addition & 1 deletion test/functional/wallet-accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class WalletAccountsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [[]]
self.extra_args = [["-deprecatedrpc=accounts"]]

def run_test(self):
node = self.nodes[0]
Expand Down
10 changes: 5 additions & 5 deletions test/functional/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def set_test_params(self):

def setup_network(self):
self.add_nodes(4)
self.start_node(0)
self.start_node(0, ["-deprecatedrpc=accounts"])
self.start_node(1)
self.start_node(2)
self.start_node(2, ["-deprecatedrpc=accounts"])
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
Expand Down Expand Up @@ -268,7 +268,7 @@ def run_test(self):

#restart the nodes with -walletbroadcast=1
self.stop_nodes()
self.start_node(0)
self.start_node(0, ["-deprecatedrpc=accounts"])
self.start_node(1)
self.start_node(2)
connect_nodes_bi(self.nodes,0,1)
Expand Down Expand Up @@ -373,7 +373,7 @@ def run_test(self):
self.log.info("check " + m)
self.stop_nodes()
# set lower ancestor limit for later
self.start_node(0, [m, "-limitancestorcount="+str(chainlimit)])
self.start_node(0, [m, "-limitancestorcount="+str(chainlimit), "-deprecatedrpc=accounts"])
self.start_node(1, [m, "-limitancestorcount="+str(chainlimit)])
self.start_node(2, [m, "-limitancestorcount="+str(chainlimit)])
while m == '-reindex' and [block_count] * 3 != [self.nodes[i].getblockcount() for i in range(3)]:
Expand Down Expand Up @@ -423,7 +423,7 @@ def run_test(self):
# Try with walletrejectlongchains
# Double chain limit but require combining inputs, so we pass SelectCoinsMinConf
self.stop_node(0)
self.start_node(0, extra_args=["-walletrejectlongchains", "-limitancestorcount="+str(2*chainlimit)])
self.start_node(0, extra_args=["-walletrejectlongchains", "-limitancestorcount="+str(2*chainlimit), "-deprecatedrpc=accounts"])

# wait for loadmempool
timeout = 10
Expand Down