Always set maxmempool to 300MB in bitcoin.conf (#2007)

When the mempool fills up to around 500MB, this causes the mempool.space
backend to crash on RPI due to OOM. Additionally, raising this above
300MB on a local RPI node arguably isn't a good idea anyway, because:

* If you have a 512MB mempool and all your peers have 300MB, you'll broadcast transactions that fit in your mempool but are rejected by all of your peers
* If you connect an SPV wallet to your node, your wallet will think the TX is "in the mempool" despite actually being purged from the entire Bitcoin P2P network, and never attempt to rebroadcast the purged TX
* In any case, the RPI has very limited RAM, so no point in wasting RAM
on having such a large sized mempool for bitcoind
This commit is contained in:
wiz 2021-03-19 05:28:15 +09:00 committed by GitHub
parent 5d462fa261
commit cd1e1f733c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,11 +149,11 @@ kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf" echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /mnt/hdd/${network}/${network}.conf sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /mnt/hdd/${network}/${network}.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=256/g" /mnt/hdd/${network}/${network}.conf sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf
fi fi
if [ ${kbSizeRAM} -gt 3500000 ]; then if [ ${kbSizeRAM} -gt 3500000 ]; then
echo "Detected RAM >3GB --> optimizing ${network}.conf" echo "Detected RAM >3GB --> optimizing ${network}.conf"
sudo sed -i "s/^maxmempool=.*/maxmempool=512/g" /mnt/hdd/${network}/${network}.conf sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf
fi fi
# link and copy HDD content into new OS on sd card # link and copy HDD content into new OS on sd card