Implement PaymentAddressBelongsToWallet for unified addresses.

This commit is contained in:
Kris Nuttycombe 2022-02-09 18:22:14 -07:00
parent 08dd842087
commit d2e8b98364
1 changed files with 15 additions and 1 deletions

View File

@ -6126,7 +6126,21 @@ bool PaymentAddressBelongsToWallet::operator()(const libzcash::SaplingPaymentAdd
}
bool PaymentAddressBelongsToWallet::operator()(const libzcash::UnifiedAddress &uaddr) const
{
// TODO
auto hdChain = m_wallet->GetMnemonicHDChain();
assert(hdChain.has_value());
auto ufvkid = m_wallet->FindUnifiedFullViewingKey(uaddr);
if (ufvkid.has_value()) {
// Look through the UFVKs that we have generated, and confirm that the
// seed fingerprint for the key we find for the ufvkid corresponds to
// the wallet's mnemonic seed.
for (const auto& [k, v] : m_wallet->mapUnifiedAccountKeys) {
if (v == ufvkid.value() && k.first == hdChain.value().GetSeedFingerprint()) {
return true;
}
}
}
return false;
}