Skip to content

Commit

Permalink
fix instantsend-related RPC output (#1628)
Browse files Browse the repository at this point in the history
* revert confirmations to its original meaning ("Blockchain Confirmations") and also remove bcconfirmations completely
* add new field instantlock (bool) to the RPC output of gettransaction, listtransactions and listsinceblock commands to indicate that tx was locked via InstantSend
* add optional `addlockconf` in addition to `minconf` parameter to all the commands where it makes sense
* fix `wallet.py` test and `vRPCConvertParams` set
* add addlockconf parameter for listreceivedbyaccount/listreceivedbyaddress commands
  • Loading branch information
Ilya Savinov authored and UdjinM6 committed Sep 20, 2017
1 parent 25fa44d commit b41f8d3
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 153 deletions.
4 changes: 2 additions & 2 deletions qa/rpc-tests/receivedby.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run_test(self):

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

Expand Down Expand Up @@ -128,7 +128,7 @@ def run_test(self):

#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"})
received_by_account_json = get_sub_array_from_array(self.nodes[1].listreceivedbyaccount(0, False, True),{"account":"mynewaccount"})
if len(received_by_account_json) == 0:
raise AssertionError("No accounts found in node")

Expand Down
4 changes: 2 additions & 2 deletions qa/rpc-tests/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ def run_test (self):
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal('200'), fee_per_byte, count_bytes(self.nodes[2].getrawtransaction(txid)))

# Sendmany 100 DASH
txid = self.nodes[2].sendmany('from1', {address: 100}, 0, "", [])
txid = self.nodes[2].sendmany('from1', {address: 100}, 0, False, "", [])
self.nodes[2].generate(1)
self.sync_all()
node_0_bal += Decimal('100')
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('100'), fee_per_byte, count_bytes(self.nodes[2].getrawtransaction(txid)))
assert_equal(self.nodes[0].getbalance(), node_0_bal)

# Sendmany 100 DASH with subtract fee from amount
txid = self.nodes[2].sendmany('from1', {address: 100}, 0, "", [address])
txid = self.nodes[2].sendmany('from1', {address: 100}, 0, False, "", [address])
self.nodes[2].generate(1)
self.sync_all()
node_2_bal -= Decimal('100')
Expand Down
10 changes: 9 additions & 1 deletion src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,20 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "instantsendtoaddress", 4 },
{ "settxfee", 0 },
{ "getreceivedbyaddress", 1 },
{ "getreceivedbyaddress", 2 },
{ "getreceivedbyaccount", 1 },
{ "getreceivedbyaccount", 2 },
{ "listreceivedbyaddress", 0 },
{ "listreceivedbyaddress", 1 },
{ "listreceivedbyaddress", 2 },
{ "listreceivedbyaddress", 3 },
{ "listreceivedbyaccount", 0 },
{ "listreceivedbyaccount", 1 },
{ "listreceivedbyaccount", 2 },
{ "listreceivedbyaccount", 3 },
{ "getbalance", 1 },
{ "getbalance", 2 },
{ "getbalance", 3 },
{ "getchaintips", 0 },
{ "getchaintips", 1 },
{ "getblockhash", 0 },
Expand All @@ -57,21 +62,24 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "move", 3 },
{ "sendfrom", 2 },
{ "sendfrom", 3 },
{ "sendfrom", 4 },
{ "listtransactions", 1 },
{ "listtransactions", 2 },
{ "listtransactions", 3 },
{ "listaccounts", 0 },
{ "listaccounts", 1 },
{ "listaccounts", 2 },
{ "walletpassphrase", 1 },
{ "walletpassphrase", 2 },
{ "getblocktemplate", 0 },
{ "listsinceblock", 1 },
{ "listsinceblock", 2 },
{ "sendmany", 1 },
{ "sendmany", 2 },
{ "sendmany", 4 },
{ "sendmany", 3 },
{ "sendmany", 5 },
{ "sendmany", 6 },
{ "sendmany", 7 },
{ "addmultisigaddress", 0 },
{ "addmultisigaddress", 1 },
{ "createmultisig", 0 },
Expand Down
Loading

0 comments on commit b41f8d3

Please sign in to comment.