From cb7bcd21ae698e4944c3e0e8fdccdd5924c55633 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Wed, 7 Mar 2018 14:42:05 -0800 Subject: [PATCH 1/2] Return JoinSplit and JoinSplitOutput indexes in z_listreceivedbyaddress --- src/wallet/rpcwallet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b242580b1..6c92a3a9b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3111,6 +3111,9 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp) obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value)))); std::string data(entry.plaintext.memo.begin(), entry.plaintext.memo.end()); obj.push_back(Pair("memo", HexStr(data))); + // (txid, jsindex, jsoutindex) is needed to globally identify a note + obj.push_back(Pair("jsindex", entry.jsop.js)); + obj.push_back(Pair("jsoutindex", entry.jsop.n)); result.push_back(obj); } return result; From afdd64c6ae60d3da785428828e27cab47a74ab92 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Tue, 27 Mar 2018 15:16:53 -0700 Subject: [PATCH 2/2] Add tests for new JoinSplit keys returned by z_listreceivedbyaddress --- qa/rpc-tests/zkey_import_export.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qa/rpc-tests/zkey_import_export.py b/qa/rpc-tests/zkey_import_export.py index 243ca3909..8e8679a50 100755 --- a/qa/rpc-tests/zkey_import_export.py +++ b/qa/rpc-tests/zkey_import_export.py @@ -89,6 +89,12 @@ class ZkeyImportExportTest (BitcoinTestFramework): try: assert_equal(amts, [tx["amount"] for tx in txs]) + for tx in txs: + # make sure JoinSplit keys exist and have valid values + assert_equal( "jsindex" in tx, True) + assert_equal( "jsoutindex" in tx, True) + assert_greater_than( tx["jsindex"], -1 ) + assert_greater_than( tx["jsoutindex"], -1 ) except AssertionError: logging.error( 'Expected amounts: %r; txs: %r',