IsNoteSaplingChange: Inline internal recipient check.
This fixes the usage of IsNoteSaplingChange in z_listreceivedbyaddress. Co-authored-by: Jack Grigg <jack@electriccoin.co>
This commit is contained in:
parent
37c5bca411
commit
da5575a02d
|
@ -2587,7 +2587,6 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
|
||||||
if (hasSaplingSpendingKey) {
|
if (hasSaplingSpendingKey) {
|
||||||
obj.pushKV(
|
obj.pushKV(
|
||||||
"change",
|
"change",
|
||||||
pwalletMain->IsInternalRecipient(entry.address) ||
|
|
||||||
pwalletMain->IsNoteSaplingChange(saplingNullifiers, entry.address, entry.op));
|
pwalletMain->IsNoteSaplingChange(saplingNullifiers, entry.address, entry.op));
|
||||||
}
|
}
|
||||||
results.push_back(obj);
|
results.push_back(obj);
|
||||||
|
|
|
@ -1599,6 +1599,11 @@ bool CWallet::IsNoteSaplingChange(
|
||||||
const libzcash::SaplingPaymentAddress& address,
|
const libzcash::SaplingPaymentAddress& address,
|
||||||
const SaplingOutPoint & op)
|
const SaplingOutPoint & op)
|
||||||
{
|
{
|
||||||
|
// Check against the wallet's change address for the associated unified account.
|
||||||
|
if (this->IsInternalRecipient(address)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// A Note is marked as "change" if the address that received it
|
// A Note is marked as "change" if the address that received it
|
||||||
// also spent Notes in the same transaction. This will catch,
|
// also spent Notes in the same transaction. This will catch,
|
||||||
// for instance:
|
// for instance:
|
||||||
|
@ -1607,8 +1612,6 @@ bool CWallet::IsNoteSaplingChange(
|
||||||
// - Notes created by consolidation transactions (e.g. using
|
// - Notes created by consolidation transactions (e.g. using
|
||||||
// z_mergetoaddress).
|
// z_mergetoaddress).
|
||||||
// - Notes sent from one address to itself.
|
// - Notes sent from one address to itself.
|
||||||
// FIXME: This also needs to check against the wallet's change address
|
|
||||||
// for the associated unified account when we add UA support
|
|
||||||
for (const SpendDescription &spend : mapWallet[op.hash].vShieldedSpend) {
|
for (const SpendDescription &spend : mapWallet[op.hash].vShieldedSpend) {
|
||||||
if (nullifierSet.count(std::make_pair(address, spend.nullifier))) {
|
if (nullifierSet.count(std::make_pair(address, spend.nullifier))) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue