Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Enable receivedby py test #206

Merged
Merged
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
2 changes: 1 addition & 1 deletion qa/pull-tester/rpc-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def option_passed(option_without_dashes):
'mintingtest',
'nodehandling',
'proxy_test',
'receivedby',
'txpropagate',
'verifydb',
'wallet',
Expand All @@ -215,7 +216,6 @@ def option_passed(option_without_dashes):
Disabled('signrawtransactions', "FAILS"),
#
Disabled('wallet-dump', "TIMEOUT"),
Disabled('receivedby', "TIMEOUT"),
Disabled('txn_doublespend --mineblock', "TIMEOUT"),
Disabled('txn_clone', "TIMEOUT"),
Disabled('notify', "TIMEOUT"),
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/rawtransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def run_test(self):
wallet.sort(key=lambda x: x["amount"], reverse=False)
utxo = wallet.pop()
amt = utxo["amount"]
addr = self.nodes[0].getaddressforms(self.nodes[0].getnewaddress())["legacy"]
addr = self.nodes[0].getnewaddress()
outp = {addr: amt-decimal.Decimal(.0001)} # give some fee
txn = createrawtransaction([utxo], outp, createWastefulOutput) # create a nonstandard tx
signedtxn = self.nodes[0].signrawtransaction(txn)
Expand Down
51 changes: 0 additions & 51 deletions qa/rpc-tests/receivedby.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,56 +90,5 @@ def run_test(self):
if balance != Decimal("0.1"):
raise AssertionError("Wrong balance returned by getreceivedbyaddress, %0.2f"%(balance))

'''
listreceivedbyaccount + getreceivedbyaccount Test
'''
#set pre-state
addrArr = self.nodes[1].getnewaddress()
account = self.nodes[1].getaccount(addrArr)
received_by_account_json = get_sub_array_from_array(self.nodes[1].listreceivedbyaccount(),{"account":account})
if len(received_by_account_json) == 0:
raise AssertionError("No accounts found in node")
balance_by_account = rec_by_accountArr = 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)
if balance != balance_by_account:
raise AssertionError("Wrong balance returned by getreceivedbyaccount, %0.2f"%(balance))

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)
if balance != balance_by_account + Decimal("0.1"):
raise AssertionError("Wrong balance returned by getreceivedbyaccount, %0.2f"%(balance))

#Create a new account named "mynewaccount" that has a 0 balance
self.nodes[1].getaccountaddress("mynewaccount")
received_by_account_json = get_sub_array_from_array(self.nodes[1].listreceivedbyaccount(0,True),{"account":"mynewaccount"})
if len(received_by_account_json) == 0:
raise AssertionError("No accounts found in node")

# Test includeempty of listreceivedbyaccount
if received_by_account_json["amount"] != Decimal("0.0"):
raise AssertionError("Wrong balance returned by listreceivedbyaccount, %0.2f"%(received_by_account_json["amount"]))

# Test getreceivedbyaccount for 0 amount accounts
balance = self.nodes[1].getreceivedbyaccount("mynewaccount")
if balance != Decimal("0.0"):
raise AssertionError("Wrong balance returned by getreceivedbyaccount, %0.2f"%(balance))

if __name__ == '__main__':
ReceivedByTest().main()