Skip to content
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
5 changes: 5 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ UniValue listshieldedunspent(const JSONRPCRequest& request)
" \"amount\": xxxxx, (numeric) the amount of value in the note\n"
" \"memo\": xxxxx, (string) hexademical string representation of memo field\n"
" \"change\": true|false, (boolean) true if the address that received the note is also one of the sending addresses\n"
" \"nullifier\": xxxxx, (string) the note's nullifier, hex encoded"
" }\n"
" ,...\n"
"]\n"
Expand Down Expand Up @@ -639,6 +640,10 @@ UniValue listshieldedunspent(const JSONRPCRequest& request)
if (hasSaplingSpendingKey) {
obj.pushKV("change", pwalletMain->GetSaplingScriptPubKeyMan()->IsNoteSaplingChange(nullifierSet, entry.address, entry.op));
}
const auto& nd = pwalletMain->mapWallet.at(entry.op.hash).mapSaplingNoteData.at(entry.op);
Comment thread
random-zebra marked this conversation as resolved.
if (nd.nullifier) {
obj.pushKV("nullifier", nd.nullifier->ToString());
}
results.push_back(obj);
}
}
Expand Down
9 changes: 9 additions & 0 deletions test/functional/sapling_wallet_listreceived.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ def run_test(self):
# Now can check that the information is the same
assert_equal(r, r2)

# Get the note nullifier
lsu = self.nodes[1].listshieldedunspent();
assert_equal(len(lsu), 1)
nullifier = lsu[0]["nullifier"]

# Generate some change by sending part of shield_addr1 to shield_addr2
txidPrev = txid
shield_addr2 = self.nodes[1].getnewshieldedaddress()
Expand All @@ -129,6 +134,10 @@ def run_test(self):
self.sync_all()
self.generate_and_sync(height+4)

# Verify the spent nullifier
tx_json = self.nodes[1].getrawtransaction(txid, True)
assert_equal(nullifier, tx_json["vShieldedSpend"][0]["nullifier"])

# Decrypted transaction details should be correct
pt = self.nodes[1].viewshieldedtransaction(txid)
assert_equal(pt['txid'], txid)
Expand Down