Merge bitcoin/bitcoin#22334: wallet: do not spam about non-existent spk managers

6084d2caed wallet: do not spam about non-existent spk managers (S3RK)

Pull request description:

  Avoid spam in logs during `loadwallet`, `listdescriptors` and probably other commands as well.

  **`loadwallet` Before:**
  ```
  2021-06-24T06:31:45Z init message: Loading wallet…
  2021-06-24T06:31:45Z [desc] Wallet File Version = 169900
  2021-06-24T06:31:45Z [desc] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Wallet completed loading in             197ms
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] setKeyPool.size() = 0
  2021-06-24T06:31:45Z [desc] mapWallet.size() = 0
  2021-06-24T06:31:45Z [desc] m_address_book.size() = 0
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] External scriptPubKey Manager for output type 2 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 0 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 1 does not exist
  2021-06-24T06:31:45Z [desc] Internal scriptPubKey Manager for output type 2 does not exist
  {
    "name": "desc",
    "warning": ""
  }
  ```

  **After:**
  ```
  2021-06-24T06:26:58Z init message: Loading wallet…
  2021-06-24T06:26:58Z [desc] Wallet File Version = 169900
  2021-06-24T06:26:58Z [desc] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0
  2021-06-24T06:26:58Z [desc] Wallet completed loading in             158ms
  2021-06-24T06:26:58Z [desc] setKeyPool.size() = 0
  2021-06-24T06:26:58Z [desc] mapWallet.size() = 0
  2021-06-24T06:26:58Z [desc] m_address_book.size() = 0
  {
    "name": "desc",
    "warning": ""
  }
  ```

ACKs for top commit:
  achow101:
    ACK 6084d2caed

Tree-SHA512: c7d7345c3182a575db088fd731b7f6e428c42e4f3f2e10d5adb50bf74a2defe88768e65ebb91a08590be48cf766a5697e36fafa73f68ffe45e76a60600f072e2
pull/826/head
fanquake 3 years ago
commit 185acdb5e8
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

@ -2982,7 +2982,6 @@ ScriptPubKeyMan* CWallet::GetScriptPubKeyMan(const OutputType& type, bool intern
const std::map<OutputType, ScriptPubKeyMan*>& spk_managers = internal ? m_internal_spk_managers : m_external_spk_managers;
std::map<OutputType, ScriptPubKeyMan*>::const_iterator it = spk_managers.find(type);
if (it == spk_managers.end()) {
WalletLogPrintf("%s scriptPubKey Manager for output type %d does not exist\n", internal ? "Internal" : "External", static_cast<int>(type));
return nullptr;
}
return it->second;

Loading…
Cancel
Save