Skip to content

Setting prune and dbcache #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BenWestgate opened this issue Mar 11, 2021 · 1 comment
Open

Setting prune and dbcache #145

BenWestgate opened this issue Mar 11, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@BenWestgate
Copy link

BenWestgate commented Mar 11, 2021

Yeti uses fixed values for dbcache and prune, which occasionally causes problems, but we can make optimum use of the user's machine's resources if we call a command to check for available memory and free disc space on first start up.

## custom prune code
installed=$(mkdir .bitcoin 2>&1 | grep "File exists" -c)  # makes ~/.bitcoin folder. If it didn't exist, installed=0
touch .bitcoin/bitcoin.conf
if [ ${installed} -eq 0 ]; then
	free_space=$(awk 'FNR ==2 {print $4+0}' <(df -BM /))  # free space in MB
	echo "prune=$(( free_space - 10000 ))" >> .bitcoin/bitcoin.conf		# subtracts 10 GB from freespace to allow for chainstate, allocates the rest to block storage.
fi
## custom dbcache code
available=$(awk '/^Mem/ {print $7}' <(free -m))		# total available memory
gnome-terminal -- ./bitcoin-qt -server -dbcache=$((available - 300)) #-proxy=127.0.0.1:9050 		# Launch Bitcoin Core in new window, necessary to use Bitcoin-cli command line interface in this script, -proxy tells it to use Tor. Sets dbcache to use all available memory less the <300 MB core uses when dbcache=0
@Rspigler Rspigler mentioned this issue Mar 13, 2021
@willweatherman
Copy link
Collaborator

This defiantly sounds like it's worth implementing Ill play with it shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants