From 77074b7b052ede11c48b9770095f3fdb9f0b5fb7 Mon Sep 17 00:00:00 2001 From: Robert Habermann Date: Fri, 3 Jan 2020 12:04:00 +0000 Subject: [PATCH] change blockchain size calculation --- home.admin/00raspiblitz.sh | 17 ++++++++++++++--- home.admin/50cloneHDD.sh | 14 +++++++------- home.admin/50copyHDD.sh | 12 ++++++------ 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/home.admin/00raspiblitz.sh b/home.admin/00raspiblitz.sh index dfd41e06..2373cab1 100755 --- a/home.admin/00raspiblitz.sh +++ b/home.admin/00raspiblitz.sh @@ -114,9 +114,20 @@ waitUntilChainNetworkIsReady() rm error.tmp # check for missing blockchain data - minSize=210000000000 - if [ "${network}" = "litecoin" ]; then - minSize=20000000000 + if [ "${network}" = "bitcoin" ]; then + if [ "${chain}" = "main" ]; then + minSize=210000000000 + else + minSize=27000000000 + fi + elif [ "${network}" = "litecoin" ]; then + if [ "${chain}" = "main" ]; then + minSize=20000000000 + else + minSize=27000000000 + fi + else + minSize=210000000000000 fi isSyncing=$(sudo ls -la /mnt/hdd/${network}/blocks/.selfsync 2>/dev/null | grep -c '.selfsync') blockchainsize=$(sudo du -shbc /mnt/hdd/${network}/ 2>/dev/null | head -n1 | awk '{print $1;}') diff --git a/home.admin/50cloneHDD.sh b/home.admin/50cloneHDD.sh index 0b46cda1..9db13c6a 100644 --- a/home.admin/50cloneHDD.sh +++ b/home.admin/50cloneHDD.sh @@ -125,22 +125,22 @@ sudo unlink /home/bitcoin/.bitcoin # make quick check if data is there anyDataAtAll=0 quickCheckOK=1 -count=$(sudo ls /mnt/hdd/bitcoin/blocks 2>/dev/null | grep -c '.dat') +count=$(sudo find /mnt/hdd/bitcoin/ -iname *.dat -type f | wc -l) if [ ${count} -gt 0 ]; then echo "Found data in /mnt/hdd/bitcoin/blocks" anyDataAtAll=1 fi -if [ ${count} -lt 3000 ]; then - echo "FAIL: transfere seems invalid - less then 3000 .dat files (${count})" +if [ ${count} -lt 300 ]; then + echo "FAIL: transfere seems invalid - less then 300 .dat files (${count})" quickCheckOK=0 fi -count=$(sudo ls /mnt/hdd/bitcoin/chainstate 2>/dev/null | grep -c '.ldb') +count=$(sudo find /mnt/hdd/bitcoin/ -iname *.ldb -type f | wc -l) if [ ${count} -gt 0 ]; then echo "Found data in /mnt/hdd/bitcoin/chainstate" anyDataAtAll=1 fi -if [ ${count} -lt 1400 ]; then - echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})" +if [ ${count} -lt 700 ]; then + echo "FAIL: transfere seems invalid - less then 700 .ldb files (${count})" quickCheckOK=0 fi @@ -178,4 +178,4 @@ fi if [ ${setupStep} -lt 100 ]; then # setup script will decide the next logical step /home/admin/10setupBlitz.sh -fi \ No newline at end of file +fi diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index bd5e266f..a172cfdf 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -88,22 +88,22 @@ read key # make quick check if data is there anyDataAtAll=0 quickCheckOK=1 -count=$(sudo ls /mnt/hdd/bitcoin/blocks 2>/dev/null | grep -c '.dat') +count=$(sudo find /mnt/hdd/bitcoin/ -iname *.dat -type f | wc -l) if [ ${count} -gt 0 ]; then echo "Found data in /mnt/hdd/bitcoin/blocks" anyDataAtAll=1 fi -if [ ${count} -lt 3000 ]; then - echo "FAIL: transfere seems invalid - less then 3000 .dat files (${count})" +if [ ${count} -lt 300 ]; then + echo "FAIL: transfere seems invalid - less then 300 .dat files (${count})" quickCheckOK=0 fi -count=$(sudo ls /mnt/hdd/bitcoin/chainstate 2>/dev/null | grep -c '.ldb') +count=$(sudo find /mnt/hdd/bitcoin/ -iname *.ldb -type f | wc -l) if [ ${count} -gt 0 ]; then echo "Found data in /mnt/hdd/bitcoin/chainstate" anyDataAtAll=1 fi -if [ ${count} -lt 1400 ]; then - echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})" +if [ ${count} -lt 700 ]; then + echo "FAIL: transfere seems invalid - less then 700 .ldb files (${count})" quickCheckOK=0 fi