Skip to content

How should -zapwallettxes interact with persistent mempool? #9710

@jnewbery

Description

@jnewbery

the zapwallettxes.py qa test is currently broken due to a syntax error:

     assert_raises(JSONRPCException, self.nodes[0].gettransaction, [txid3])
     #there must be a expection because the unconfirmed wallettx0 must be gone by now

This doesn't actually test that the transaction is not in the wallet, because gettransaction() is being called incorrectly (with an array instead of a string).

Changing the test to assert_raises(JSONRPCException, self.nodes[0].gettransaction, txid3) causes the rpc to succeed and the test script to fail because txid3 is still in the wallet.

This is because the mempool is now persistent and is saved to disk when bitcoind shuts down. zapwallettxes removes the unconfirmed transaction from the wallet but bitcoind will rescan the mempool.dat file on startup and add the unconfirmed transaction back into the wallet.

I've 'fixed' zapwallettxes.py in https://github.com/jnewbery/bitcoin/tree/zapwallettxes , but the question remains: how should -zapwallettxes interact with persistent mempool? The use case for zapwallettxes is explained here: #3659 (comment) . My view is that even with zapwallettxes, bitcoind should rescan the mempool, but there should be better documentation or a warning that unconfirmed transaction in your mempool will be re-added to the wallet even if zapwallettxes is used. If you really want to remove all unconfirmed transactions from your wallet, you can delete your mempool.dat file and then restart with zapwallettxes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions