Apply suggestions from code review

This commit is contained in:
Kris Nuttycombe 2022-03-09 15:10:16 -07:00
parent e63d52896a
commit f057ebb375
4 changed files with 10 additions and 8 deletions

View File

@ -75,7 +75,7 @@ bool orchard_wallet_rewind(
/**
* A C struct used to transfer action_idx/IVK pairs back from Rust across the FFI
* boundary. This must have the same in-memory representation as the `NoteMetadata` type
* boundary. This must have the same in-memory representation as the `FFIActionIVK` type
* in orchard_ffi/wallet.rs.
*
* Values of the `ivk` pointer must be freed manually; the best way to do this is to
@ -201,7 +201,7 @@ OrchardIncomingViewingKeyPtr* orchard_wallet_get_ivk_for_address(
/**
* A C struct used to transfer note metadata information across the Rust FFI boundary.
* This must have the same in-memory representation as the `NoteMetadata` type in
* This must have the same in-memory representation as the `FFINoteMetadata` type in
* orchard_ffi/wallet.rs.
*/
struct RawOrchardNoteMetadata {

View File

@ -846,7 +846,7 @@ bool CWallet::LoadUnifiedAddressMetadata(const ZcashdUnifiedAddressMetadata &add
addrmeta.GetReceiverTypes());
}
bool CWallet::LoadUnifiedCaches()
bool CWallet::LoadCaches()
{
AssertLockHeld(cs_wallet);
@ -953,6 +953,8 @@ bool CWallet::LoadUnifiedCaches()
blockHeight = pTxIndex->nHeight;
}
if (!orchardWallet.RestoreDecryptedNotes(blockHeight, walletTx, walletTx.mapOrchardActionData)) {
LogPrintf("%s: Error: Failed to decrypt previously decrypted notes for txid %s.\n",
__func__, walletTx.GetHash().GetHex());
return false;
}
}

View File

@ -1555,7 +1555,7 @@ public:
//!
//! Returns true if and only if there were no detected inconsistencies or
//! failures in reconstructing the cache.
bool LoadUnifiedCaches();
bool LoadCaches();
std::optional<libzcash::UFVKId> FindUnifiedFullViewingKey(const libzcash::UnifiedAddress& addr) const;
std::optional<libzcash::AccountId> GetUnifiedAccountId(const libzcash::UFVKId& ufvkId) const;

View File

@ -964,7 +964,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
pcursor->close();
// Load unified address/account/key caches based on what was loaded
if (!pwallet->LoadUnifiedCaches()) {
if (!pwallet->LoadCaches()) {
// We can be more permissive of certain kinds of failures during
// loading; for now we'll interpret failure to reconstruct the
// caches to be "as bad" as losing keys.
@ -1291,11 +1291,11 @@ bool CWalletDB::Recover(CDBEnv& dbenv, const std::string& filename, bool fOnlyKe
ptxn->commit(0);
pdbCopy->close(0);
// Try to load the unified caches, uncovering inconsistencies in wallet
// Try to load the wallet's caches, uncovering inconsistencies in wallet
// records like missing viewing key records despite existing account
// records.
if (!dummyWallet.LoadUnifiedCaches()) {
LogPrintf("WARNING: unified caches could not be reconstructed; salvaged wallet file may have omissions");
if (!dummyWallet.LoadCaches()) {
LogPrintf("WARNING: wallet caches could not be reconstructed; salvaged wallet file may have omissions");
}
return fSuccess;