Skip to content

Commit 26f59f5

Browse files
committed
Merge #12992: [wallet] Add wallet name to log messages
909f54c [wallet] Add wallet name to log messages (Pierre Rochard) Pull request description: After multiple wallets became supported, wallet-related log messages became ambiguous as to which wallet they were being emitted by. This pull request adds a `CWallet::WalletLogPrintf` function to be used when logging wallet-specific events. This function prepends the wallet's name to the log message and forwards it to `LogPrintf` fixes #11317 Tree-SHA512: d258dcc9aa0f1330159bc66b4020f84709c5bba5165bdc62503543557d8999777f0b94a7a82a08823e2b2ceb84f4f8d1cd5493f99c076a13539f1f6155dc55ad
2 parents 317477a + 909f54c commit 26f59f5

File tree

5 files changed

+66
-54
lines changed

5 files changed

+66
-54
lines changed

src/wallet/feebumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Result CreateTransaction(const CWallet* wallet, const uint256& txid, const CCoin
195195
// If the output would become dust, discard it (converting the dust to fee)
196196
poutput->nValue -= nDelta;
197197
if (poutput->nValue <= GetDustThreshold(*poutput, GetDiscardRate(*wallet, ::feeEstimator))) {
198-
LogPrint(BCLog::RPC, "Bumping fee and discarding dust output\n");
198+
wallet->WalletLogPrintf("Bumping fee and discarding dust output\n");
199199
new_fee += poutput->nValue;
200200
mtx.vout.erase(mtx.vout.begin() + nOutput);
201201
}

src/wallet/rpcdump.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ UniValue importwallet(const JSONRPCRequest& request)
553553

554554
// Use uiInterface.ShowProgress instead of pwallet.ShowProgress because pwallet.ShowProgress has a cancel button tied to AbortRescan which
555555
// we don't want for this progress bar showing the import progress. uiInterface.ShowProgress does not have a cancel button.
556-
uiInterface.ShowProgress(_("Importing..."), 0, false); // show progress dialog in GUI
556+
uiInterface.ShowProgress(strprintf("%s " + _("Importing..."), pwallet->GetDisplayName()), 0, false); // show progress dialog in GUI
557557
while (file.good()) {
558558
uiInterface.ShowProgress("", std::max(1, std::min(99, (int)(((double)file.tellg() / (double)nFilesize) * 100))), false);
559559
std::string line;
@@ -571,7 +571,7 @@ UniValue importwallet(const JSONRPCRequest& request)
571571
assert(key.VerifyPubKey(pubkey));
572572
CKeyID keyid = pubkey.GetID();
573573
if (pwallet->HaveKey(keyid)) {
574-
LogPrintf("Skipping import of %s (key already present)\n", EncodeDestination(keyid));
574+
pwallet->WalletLogPrintf("Skipping import of %s (key already present)\n", EncodeDestination(keyid));
575575
continue;
576576
}
577577
int64_t nTime = DecodeDumpTime(vstr[1]);
@@ -589,7 +589,7 @@ UniValue importwallet(const JSONRPCRequest& request)
589589
fLabel = true;
590590
}
591591
}
592-
LogPrintf("Importing %s...\n", EncodeDestination(keyid));
592+
pwallet->WalletLogPrintf("Importing %s...\n", EncodeDestination(keyid));
593593
if (!pwallet->AddKeyPubKey(key, pubkey)) {
594594
fGood = false;
595595
continue;
@@ -603,11 +603,11 @@ UniValue importwallet(const JSONRPCRequest& request)
603603
CScript script = CScript(vData.begin(), vData.end());
604604
CScriptID id(script);
605605
if (pwallet->HaveCScript(id)) {
606-
LogPrintf("Skipping import of %s (script already present)\n", vstr[0]);
606+
pwallet->WalletLogPrintf("Skipping import of %s (script already present)\n", vstr[0]);
607607
continue;
608608
}
609609
if(!pwallet->AddCScript(script)) {
610-
LogPrintf("Error importing script %s\n", vstr[0]);
610+
pwallet->WalletLogPrintf("Error importing script %s\n", vstr[0]);
611611
fGood = false;
612612
continue;
613613
}

0 commit comments

Comments
 (0)