Skip to content

Commit

Permalink
wallet, logging: Switch LogInfo to LogError in AddWalletDescriptor
Browse files Browse the repository at this point in the history
Seems like all of these cases are treated as errors, so it makes sense to use
the corresponding log level.

Change suggested by hodlinator in bitcoin#30343 (comment)
  • Loading branch information
ryanofsky committed Dec 5, 2024
1 parent 8e9e7b9 commit 4c8fe04
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3923,13 +3923,13 @@ ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const Flat
AssertLockHeld(cs_wallet);

if (!IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
LogInfo(m_log, "Cannot add WalletDescriptor to a non-descriptor wallet\n");
LogError(m_log, "Cannot add WalletDescriptor to a non-descriptor wallet\n");
return nullptr;
}

auto spk_man = GetDescriptorScriptPubKeyMan(desc);
if (spk_man) {
LogInfo(m_log, "Update existing descriptor: %s\n", desc.descriptor->ToString());
LogError(m_log, "Update existing descriptor: %s\n", desc.descriptor->ToString());
spk_man->UpdateWalletDescriptor(desc);
} else {
auto new_spk_man = std::unique_ptr<DescriptorScriptPubKeyMan>(new DescriptorScriptPubKeyMan(*this, desc, m_keypool_size));
Expand All @@ -3948,7 +3948,7 @@ ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const Flat

// Top up key pool, the manager will generate new scriptPubKeys internally
if (!spk_man->TopUp()) {
LogInfo(m_log, "Could not top up scriptPubKeys\n");
LogError(m_log, "Could not top up scriptPubKeys\n");
return nullptr;
}

Expand All @@ -3957,7 +3957,7 @@ ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const Flat
if (!desc.descriptor->IsRange()) {
auto script_pub_keys = spk_man->GetScriptPubKeys();
if (script_pub_keys.empty()) {
LogInfo(m_log, "Could not generate scriptPubKeys (cache is empty)\n");
LogError(m_log, "Could not generate scriptPubKeys (cache is empty)\n");
return nullptr;
}

Expand Down

0 comments on commit 4c8fe04

Please sign in to comment.