walletdb: don't reinitialize desc cache with multiple cache entries #19441

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:fix-desc-cache-load changing 2 files +12 −3
  1. achow101 commented at 1:22 AM on July 4, 2020: member

    When loading descriptor caches, we would accidentally reinitialize the descriptor cache when seeing that one already exists. This should have only been initializing the cache when one does not exist. However this code itself is unnecessary as the act of looking up the cache to add to it will initialize it if it didn't already exist.

    This issue could be hit by trying to load a wallet that had imported a multisig descriptor. The wallet would fail to load.

    A test has been added to wallet_importdescriptors.py to catch this case. Another test case has also been added to check that loading a wallet with only single key descriptors works.

  2. walletdb: don't reinitialize desc cache with multiple cache entries
    When loading descriptor caches, we would accidentally reinitialize the
    descriptor cache when seeing that one already exists. This should have
    only been initializing the cache when one does not exist. However this
    code itself is unnecessary as the act of looking up the cache to add to
    it will initialize it if it didn't already exist.
    
    This issue could be hit by trying to load a wallet that had imported a
    multisig descriptor. The wallet would fail to load.
    
    A test has been added to wallet_importdescriptors.py to catch this case.
    Another test case has also been added to check that loading a wallet
    with only single key descriptors works.
    a66a7a1a70
  3. fanquake added the label Wallet on Jul 4, 2020
  4. jonatack commented at 9:36 AM on July 5, 2020: member

    ACK a66a7a1a706

    Without the change in wallet/walletdb.cpp::595-597 the updated test fails on reloading the wallet at line 383 with the error message from DescriptorScriptPubKeyMan::SetCache Error: Unable to expand wallet descriptor from cache (-4).

  5. hugohn commented at 8:19 AM on July 8, 2020: contributor

    tACK a66a7a1

  6. meshcollider commented at 12:05 PM on July 11, 2020: contributor

    Code review ACK a66a7a1a7060bb422eba3b8c214852416c4280d1

    Verified the test fails on master and passes with the code change

  7. meshcollider merged this on Jul 11, 2020
  8. meshcollider closed this on Jul 11, 2020

  9. sidhujag referenced this in commit 984fb6f996 on Jul 11, 2020
  10. Fabcien referenced this in commit d8cf280d8e on Aug 31, 2021
  11. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 00:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me