How to cleanup mempool 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 :)
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:  


Shutdown Bitcoin Core $ bitcoin-cli -testnet3 stop
Delete mempool.dat $ rm ~/.bitcoin/testnet3/mempool.dat
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