<p>First of all, clearing your mempool doesn't really do anything if the transactions you're clearing have already propagated through the network. The mempool will sync again when you connect to other peers.</p>

<p><code>mempool.dat</code> was introduced in <code>0.14.0</code> and will persist the mempool on shutdown. In order to clear the mempool you have to:  </p>

<ol>
<li>Shutdown Bitcoin Core <code>$ bitcoin-cli -testnet3 stop</code></li>
<li>Delete mempool.dat <code>$ rm ~/.bitcoin/testnet3/mempool.dat</code></li>
<li>Restart the daemon <code>$ bitcoind -testnet -zapwallettxes</code></li>
</ol>

<p><strong>Note:</strong> You might also need start the daemon with <code>-zapwallettxes</code> so the transactions related to your wallet aren't loaded into the mempool at startup.</p>

<p><strong>Another Note</strong>: If you only want to remove transactions related to your wallet, you can skip step 2: <a href="https://github.com/bitcoin/bitcoin/pull/10330" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/pull/10330</a></p>

CC BY-SA 4.0
2022-12-29T12:31:21.043Z
`-zapwallettxes` has been removed from bitcoin-core. Use `abandontransaction` to clear an orphaned Tx from the wallet.
rustyx
CC BY-SA 4.0
2018-09-07T13:53:17.737Z
2019-06-06T18:01:05.023Z
2019-06-06T18:01:05.023Z
JBaczuk
<p>I want to cleanup mempool.
I googled and knew -zapwallettxes might clean up mempool.</p>

<p>But when I do the following command, mempool is still loaded.</p>

<blockquote>
  <p>./bitcoind -testnet=3 -server -rest -dbcache=4000 -txindex=1 -rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0 -printtoconsole -zapwallettxs=2 -rescan</p>
</blockquote>

<p>In this situation, even if I restart bitcoind, mempool is dumped to .bitcoin/testnet3/mempool.dat and loaded on startup.</p>

<p>how should I clean up mempool?</p>

<p>Any comments and advices are welcomed :)</p>

CC BY-SA 4.0
2018-09-07T09:35:41.160Z
Have you tried using the option `maxmempool=N`, where N is the maximum size of your mempool in megabytes?
Pedro
CC BY-SA 4.0
2018-09-07T14:24:00.870Z
Why are you doing this?  What do you hope to accomplish by "cleaning up" the mempool?
Nate Eldredge
<bitcoind><mempool>
How to cleanup mempool
yoyoyousei
# How to cleanup mempool

(Asked by: username_0 on 2018-09-07)

I want to cleanup mempool.
I googled and knew -zapwallettxes might clean up mempool.

But when I do the following command, mempool is still loaded.

> ./bitcoind -testnet=3 -server -rest -dbcache=4000 -txindex=1 -rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0 -printtoconsole -zapwallettxs=2 -rescan

In this situation, even if I restart bitcoind, mempool is dumped to .bitcoin/testnet3/mempool.dat and loaded on startup.

how should I clean up mempool?

Any comments and advices are welcomed :)

**Tags:** bitcoind, mempool

> **Comments:**
> **username_1**: Have you tried using the option `maxmempool=N`, where N is the maximum size of your mempool in megabytes?  
> **username_2**: Why are you doing this?  What do you hope to accomplish by "cleaning up" the mempool?  

---

## 1 answers

### Answer by username_3 on 2018-09-07. Score: 2 | Accepted answer

First of all, clearing your mempool doesn't really do anything if the transactions you're clearing have already propagated through the network. The mempool will sync again when you connect to other peers.

`mempool.dat` was introduced in `0.14.0` and will persist the mempool on shutdown. In order to clear the mempool you have to:

1. Shutdown Bitcoin Core `$ bitcoin-cli -testnet3 stop`
2. Delete mempool.dat `$ rm ~/.bitcoin/testnet3/mempool.dat`
3. Restart the daemon `$ bitcoind -testnet -zapwallettxes`

**Note:** You might also need start the daemon with `-zapwallettxes` so the transactions related to your wallet aren't loaded into the mempool at startup.

**Another Note**: If you only want to remove transactions related to your wallet, you can skip step 2: <https://github.com/bitcoin/bitcoin/pull/10330>

> **Comments:**
> **username_4**: `-zapwallettxes` has been removed from bitcoin-core. Use `abandontransaction` to clear an orphaned Tx from the wallet.  

---

