diff options
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 9f9501cf72..06a7c0a752 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -102,7 +102,7 @@ constexpr OutputType DEFAULT_CHANGE_TYPE{OutputType::CHANGE_AUTO}; enum WalletFlags : uint64_t { // wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown - // unkown wallet flags in the lower section <= (1 << 31) will be tolerated + // unknown wallet flags in the lower section <= (1 << 31) will be tolerated // will enforce the rule that the wallet can't contain any private keys (only watch-only/pubkeys) WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32), @@ -1195,6 +1195,19 @@ public: /** overwrite all flags by the given uint64_t returns false if unknown, non-tolerable flags are present */ bool SetWalletFlags(uint64_t overwriteFlags, bool memOnly); + + /** Returns a bracketed wallet name for displaying in logs, will return [default wallet] if the wallet has no name */ + const std::string GetDisplayName() const { + std::string wallet_name = GetName().length() == 0 ? "default wallet" : GetName(); + return strprintf("[%s]", wallet_name); + }; + + /** Prepends the wallet name in logging output to ease debugging in multi-wallet use cases */ + template<typename... Params> + void WalletLogPrintf(std::string fmt, Params... parameters) const { + LogPrintf(("%s " + fmt).c_str(), GetDisplayName(), parameters...); + }; + }; /** A key allocated from the key pool. */ |