diff --git a/qa/rpc-tests/zkey_import_export.py b/qa/rpc-tests/zkey_import_export.py index 65a80b9fb..1be399636 100755 --- a/qa/rpc-tests/zkey_import_export.py +++ b/qa/rpc-tests/zkey_import_export.py @@ -59,6 +59,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', diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 7125bdef5..87b950bb3 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3243,6 +3243,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;