Skip to content

Commit

Permalink
cleanup logs
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Jan 9, 2024
1 parent a369f2c commit 1132f18
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
7 changes: 0 additions & 7 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,11 +1420,9 @@ bool LegacyScriptPubKeyMan::TopUpInner(unsigned int kpSize)
int64_t missingExternal = std::max(std::max((int64_t) nTargetSize, (int64_t) 1) - amountExternal, (int64_t) 0);
int64_t missingInternal = std::max(std::max((int64_t) nTargetSize, (int64_t) 1) - amountInternal, (int64_t) 0);

LogPrintf("stats: %d/%d %d/%d\n", amountExternal, missingExternal, amountInternal, missingInternal);
if (!IsHDEnabled())
{
// don't create extra internal keys
LogPrintf("no hd enabled!\n");
missingInternal = 0;
}

Expand All @@ -1444,14 +1442,11 @@ bool LegacyScriptPubKeyMan::TopUpInner(unsigned int kpSize)
bool fInternal = false;
int64_t current_index{0};
WalletBatch batch(m_storage.GetDatabase());
LogPrintf("top up keys! total: %d internal: %d external: %d\n",
total_missing, missingInternal, missingExternal);

for (current_index = 0; current_index < total_missing; ++current_index) {
if (current_index == missingExternal) {
fInternal = true;
}
LogPrintf("next: %d internal: %d\n", current_index, fInternal);

// TODO: implement keypools for all accounts?
CPubKey pubkey(GenerateNewKey(batch, 0, fInternal));
Expand Down Expand Up @@ -1495,10 +1490,8 @@ void LegacyScriptPubKeyMan::AddKeypoolPubkeyWithDB(const CPubKey& pubkey, const
}
if (internal) {
setInternalKeyPool.insert(index);
LogPrintf("internals: %d\n", setInternalKeyPool.size());
} else {
setExternalKeyPool.insert(index);
LogPrintf("externals: %d\n", setInternalKeyPool.size());
}
m_pool_key_to_index[pubkey.GetID()] = index;
}
Expand Down
6 changes: 0 additions & 6 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,15 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, const std::strin
// TODO: re-enable this and `keypoolsize_hd_internal` check in `wallet_createwallet.py`
// when HD is the default mode (make sure this actually works!)...
// if (auto spk_man = wallet->GetLegacyScriptPubKeyMan()) {
LogPrintf("use hd cp-1: %d %d\n", wallet->IsHDEnabled(), wallet->GetLegacyScriptPubKeyMan()->IsHDEnabled());
{
// NOTE: drop this condition after removing option to create non-HD wallets
// if (spk_man->IsHDEnabled()) {
LogPrintf("knst create wallet checkpoint version %d/%d\n", wallet->GetVersion(), FEATURE_HD);
if (wallet->GetVersion() >= FEATURE_HD) {
LogPrintf("knst create chain!\n");
if (!wallet->GenerateNewHDChainEncrypted("", "", passphrase)) {
error = Untranslated("Error: Failed to generate encrypted HD wallet");
status = DatabaseStatus::FAILED_CREATE;
return nullptr;
}
LogPrintf("use hd cp-2: %d %d\n", wallet->IsHDEnabled(), wallet->GetLegacyScriptPubKeyMan()->IsHDEnabled());
}
}
// ... and drop this
Expand All @@ -356,10 +352,8 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, const std::strin
return nullptr;
}

LogPrintf("use hd cp-3: %d %d\n", wallet->IsHDEnabled(), wallet->GetLegacyScriptPubKeyMan()->IsHDEnabled());
// Relock the wallet
wallet->Lock();
LogPrintf("use hd cp-4: %d %d\n", wallet->IsHDEnabled(), wallet->GetLegacyScriptPubKeyMan()->IsHDEnabled());
}
}
AddWallet(wallet);
Expand Down
2 changes: 0 additions & 2 deletions test/functional/wallet_createwallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def run_test(self):
assert_raises_rpc_error(-13, "Error: Please enter the wallet passphrase with walletpassphrase first.", w6.signmessage, "needanargument", "test")
w6.walletpassphrase('thisisapassphrase', 60)
w6.signmessage(w6.getnewaddress(), "test")
self.log.info(f"info: {w6.getwalletinfo()}")
w6.keypoolrefill(1)
self.log.info(f"info: {w6.getwalletinfo()}")
# There should only be 1 key
walletinfo = w6.getwalletinfo()
assert_equal(walletinfo['keypoolsize'], 1)
Expand Down

0 comments on commit 1132f18

Please sign in to comment.