wallet: rather than assert, error in case of inconsistency between FVK and address

This commit is contained in:
Sean Bowe 2022-03-02 11:05:04 -07:00
parent 3665f69a48
commit c5b87ba163
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
1 changed files with 6 additions and 1 deletions

View File

@ -902,7 +902,12 @@ bool CWallet::LoadUnifiedCaches()
// an orchard receiver present in this address.
auto orchardFvk = ufvk.value().GetOrchardKey();
auto orchardReceiver = addr.first.GetOrchardReceiver();
assert (orchardFvk.has_value() == orchardReceiver.has_value());
if (orchardFvk.has_value() != orchardReceiver.has_value()) {
// Inconsistency between full viewing key and address
// metadata.
return false;
}
if (orchardFvk.has_value()) {
if (!AddOrchardRawAddress(orchardFvk.value().ToIncomingViewingKey(), orchardReceiver.value())) {