Fix overzealous matching of Orchard FVKs to addresses.

It is possible for an address to be generated for a UFVK that
contains an Orchard FVK, but where the address does not contain
an Orchard receiver. Cache restoration was failing on startup
because we failed to allow for this case.
This commit is contained in:
Kris Nuttycombe 2022-03-28 15:26:13 -06:00
parent 0b8ee33bbd
commit e07e355e01
1 changed files with 1 additions and 7 deletions

View File

@ -1100,13 +1100,7 @@ bool CWallet::LoadCaches()
auto orchardFvk = ufvk.value().GetOrchardKey();
auto orchardReceiver = addr.first.GetOrchardReceiver();
if (orchardFvk.has_value() != orchardReceiver.has_value()) {
LogPrintf("%s: Error: Orchard receiver in unified address is inconsistent with the unified viewing key.\n",
__func__);
return false;
}
if (orchardFvk.has_value()) {
if (orchardFvk.has_value() && orchardReceiver.has_value()) {
if (!AddOrchardRawAddress(orchardFvk.value().ToIncomingViewingKey(), orchardReceiver.value())) {
LogPrintf("%s: Error: Unable to add Orchard address -> IVK mapping.\n",
__func__);