wallet: copied wallet detection problem #14304

issue ken2812221 opened this issue on September 24, 2018
  1. ken2812221 commented at 1:00 AM on September 24, 2018: contributor

    <!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

    <!-- Describe the issue -->

    <!--- What behavior did you expect? -->

    <!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

    <!--- How reliably can you reproduce the issue, what are the steps to do so? -->

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

    src/bitcoind -daemon -regtest
    src/bitcoin-cli -regtest stop
    cp ~/.bitcoin/wallet/wallet.dat ~/.bitcoin/wallet/wallet2.dat
    src/bitcoind -daemon -regtest
    src/bitcoin-cli -regtest loadwallet wallet2.dat # The first time it would fail to load wallet
    src/bitcoin-cli -regtest loadwallet wallet2.dat # The second time it would succeed to load wallet, but this would cause error because of duplicate fileid
    

    It would flush wallet.dat and close Db* in mapDb['wallet.dat'].second, so mapDb['wallet.dat'].second would be nullptr. Then there is no available Db* to detect if the wallet fileid is duplicated.

    I'm not sure if the issue is related to #14163, but I found this while debugging it.

    https://github.com/bitcoin/bitcoin/blob/920c090f63f4990bf0f3b3d1a6d3d8a8bcd14ba0/src/wallet/db.cpp#L32-L53

  2. fanquake added the label Wallet on Sep 24, 2018
  3. MarcoFalke added the label Bug on Sep 24, 2018
  4. MarcoFalke added this to the milestone 0.18.0 on Sep 24, 2018
  5. laanwj closed this on Oct 24, 2018

  6. laanwj referenced this in commit 2b88f67e0b on Oct 24, 2018
  7. xdustinface referenced this in commit 3738170471 on Apr 4, 2021
  8. xdustinface referenced this in commit dc09345e28 on Apr 4, 2021
  9. xdustinface referenced this in commit 85349ca1f7 on Apr 4, 2021
  10. xdustinface referenced this in commit 86357cc55f on Apr 5, 2021
  11. xdustinface referenced this in commit 3bee6d011c on Apr 13, 2021
  12. DrahtBot locked this on Sep 8, 2021
  13. gades referenced this in commit 6479be240b on Mar 22, 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-05-03 15:15 UTC

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