Skip to content

Conversation

S3RK
Copy link
Contributor

@S3RK S3RK commented Jun 24, 2021

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": ""
}

@jonatack
Copy link
Member

Concept ACK

@practicalswift
Copy link
Contributor

Concept ACK: we should avoid spamming the default log using LogPrintf

@theStack
Copy link
Contributor

Concept ACK

@achow101
Copy link
Member

achow101 commented Jun 29, 2021

I think that it is still useful to log this information once. It's useful for debugging wallet issues to know what spkmans are available to the wallet. Perhaps we can add another log line WalletBatch::LoadWallet containing this information.

@S3RK
Copy link
Contributor Author

S3RK commented Jun 30, 2021

Active spk managers are logged already from CWallet::LoadActiveScriptPubKeyMan like so

2021-06-30T06:54:48Z init message: Loading wallet…
2021-06-30T06:54:48Z [test2] Setting spkMan to active: id = 103bfd1f5080799f7b453bf401c6659df5a9cfd5b3edef85c117788d57c39e64, type = 0, internal = 0
2021-06-30T06:54:48Z [test2] Setting spkMan to active: id = 9213dc6fd9d768d5a1cd1280339ea9457071cf4626ba1b0c8eb37d0995390bfc, type = 1, internal = 0
2021-06-30T06:54:48Z [test2] Setting spkMan to active: id = 83732db7350e6e62e4bc305845bf25419811dd1f1baa9cc08f2c2f21371e8c76, type = 2, internal = 0
2021-06-30T06:54:48Z [test2] Setting spkMan to active: id = b4287a0c00459077db00780d77c3dabfce3432f49cdc645e8e65242b62cf4f84, type = 0, internal = 1
2021-06-30T06:54:48Z [test2] Setting spkMan to active: id = c4c767db2ae9e61fbdb39ef449104896639b0a0cf8d1e2aa56a472be754a7080, type = 1, internal = 1
2021-06-30T06:54:48Z [test2] Setting spkMan to active: id = f5536f928bd394f1ae91956915f2de1020d9501d0584ba4314adfa1a49276e0b, type = 2, internal = 1
2021-06-30T06:54:49Z [test2] Wallet File Version = 169900
2021-06-30T06:54:49Z [test2] Keys: 6 plaintext, 0 encrypted, 0 w/ metadata, 6 total. Unknown wallet records: 0
2021-06-30T06:54:49Z [test2] Wallet completed loading in             947ms
2021-06-30T06:54:49Z init message: Rescanning…
2021-06-30T06:54:49Z [test2] Rescanning last 2 blocks (from block 0)...
2021-06-30T06:54:49Z [test2] Rescan started from block 6c89bd3c030e18dfbde4e214d5cfe5789169b3e1a459e816a6dbbbcf82fd2023...
2021-06-30T06:54:49Z [test2] Rescan completed in               3ms
2021-06-30T06:54:49Z [test2] setKeyPool.size() = 6000
2021-06-30T06:54:49Z [test2] mapWallet.size() = 0
2021-06-30T06:54:49Z [test2] m_address_book.size() = 0
{
  "name": "test2",
  "warning": ""
}

@achow101
Copy link
Member

Oh right, we do have that.

ACK 6084d2c

@fanquake
Copy link
Member

fanquake commented Jul 1, 2021

@S3RK I take it this is still relevant post #19651 / #21716 ?

@S3RK
Copy link
Contributor Author

S3RK commented Jul 1, 2021

@fanquake this still relevant.

I was wrong when I said #19651 fixes #21716. It only fixes a part of it, the part addressed in #21880.

This PR should fully address #21716

@fanquake fanquake merged commit 185acdb into bitcoin:master Jul 1, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 1, 2021
6084d2c 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 6084d2c

Tree-SHA512: c7d7345c3182a575db088fd731b7f6e428c42e4f3f2e10d5adb50bf74a2defe88768e65ebb91a08590be48cf766a5697e36fafa73f68ffe45e76a60600f072e2
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants