Bad interaction of -zapwallettxes and pruning / multiwallet #12505

issue bpay opened this issue on February 21, 2018
  1. bpay commented at 8:41 PM on February 21, 2018: contributor

    After some googling, I recently ran bitcoin-qt -zapwallettxes on a 0.15.1 pruned multiwallet node in order to remove a stuck transaction from the transaction list, without fully understanding what I was doing. After running the command and realizing what I'd done, I was surprised to learn

    1. The operation succeeded without warning despite the fact I was running a multiwallet configuration
    2. The operation succeeded without warning even though I was running a pruned node. Meaning I now had to re-download and verify the full blockchain to get my wallets' transactions back
    3. The software made no wallet backups despite the destructive nature of the operation

    After some poking around in the code a bit it appears there are safeguards against 1 and 2, but they didn't trigger in this case. Maybe because my pruning and wallet options were being set via bitcoin.conf instead of the command line?

    <!-- 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. -->

  2. MarcoFalke added the label Wallet on Feb 21, 2018
  3. jnewbery commented at 5:36 PM on April 4, 2018: member

    I'm surprised that -zapwallettxes worked with multiwallet. Are you sure that you were running with multiple -wallet arguments when you started with -zapwallettxes? Are you able to share your debug.log?

    I agree that zapwallettxes should trigger a backup.

    Longer term, zapwallettxes should move to a separate bitcoin-wallet-tool utility. See #8745.

  4. bpay commented at 9:17 PM on April 16, 2018: contributor

    I was loading the wallets via bitcoin.conf rather than -wallet. The -zapwallettxes sanity checks appear to only look at command line args for conflicts and ignore conf file options.

  5. MarcoFalke added this to the milestone 0.17.0 on Apr 16, 2018
  6. jnewbery commented at 9:49 PM on April 16, 2018: member

    The -zapwallettxes sanity checks appear to only look at command line args

    I don't think that's it. All the gArgs functions work on the combined command line and conf file arguments.

    I've tried this myself (with the following config):

    daemon=1
    debug=all
    server=1
    regtest=1
    
    [regtest]
    wallet=w1
    wallet=w2
    zapwallettxes=1
    

    and bitcoind refuses to start as expected:

    Error: -zapwallettxes is only allowed with a single wallet file
    
  7. MarcoFalke commented at 9:58 PM on April 16, 2018: member

    Jup, that check was added in 9cbe8c80bad1b55557a91db65a06b66ec4743f18 and is thus in 0.15.0 and later.

    Marking "good first issue", since those are untested right now. Could add a test by modifying ./test/functional/wallet_multiwallet.py

  8. MarcoFalke added the label good first issue on Apr 16, 2018
  9. bpay commented at 10:44 PM on April 16, 2018: contributor

    I'm starting bitcoin with bitcoin-qt -datadir=c:\bitcoindata -zapwallettxes and with config

    wallet=wallet1.dat
    wallet=wallet2.dat
    prune=1
    
  10. bpay commented at 10:47 PM on April 16, 2018: contributor
  11. jnewbery commented at 3:22 PM on April 19, 2018: member

    @bpay - thanks for reporting this and providing the debug.log trace. I've reproduced and PR'ed a fix at #13030.

    The bug is that the -zapwallettxes multiwallet check works when providing zapwallettxes=1 (which is always the case in .conf files), but not when providing -zapwallettxes.

  12. laanwj closed this on Apr 23, 2018

  13. laanwj referenced this in commit d3f04c0e81 on Apr 23, 2018
  14. MarcoFalke removed the label good first issue on Apr 23, 2018
  15. PastaPastaPasta referenced this in commit 3c4d371aee on Nov 10, 2020
  16. PastaPastaPasta referenced this in commit 08d10efd04 on Nov 12, 2020
  17. PastaPastaPasta referenced this in commit ca0cdbfbe8 on Nov 17, 2020
  18. MarcoFalke locked this on Sep 8, 2021
  19. gades referenced this in commit 4b0bfc36e7 on Mar 27, 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-15 15:15 UTC

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