Skip to content

Commit d543be2

Browse files
committed
Bootstrap skipped if already done. Raven status improved updated max 1 per minute. RVN node reindex the first time it runs
1 parent b29df3a commit d543be2

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

files/raven.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ maxmempool=50
1212
disablewallet=1
1313
logips=1
1414
maxconnections=30
15-
maxuploadtarget=5000
15+
maxuploadtarget=20000

files/raven_status

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
#!/bin/bash
2+
3+
net_info=$(raven-cli getnetworkinfo)
4+
node_ver=$(echo ${net_info} | jq -r '.subversion' | awk -F/ '{print $2}')
5+
node_ip=$(echo ${net_info} | jq -r '.localaddresses[] | .address')
6+
node_port=$(echo ${net_info} | jq -r '.localaddresses[] | .port')
7+
node_score=$(echo ${net_info} | jq -r '.localaddresses[] | .score')
8+
9+
echo "Node version: ${node_ver}"
10+
echo "Node IP/port: ${node_ip}/${node_port}"
11+
echo "Node score: ${node_score}"
12+
213
count=$(raven-cli getblockcount)
314
echo "block count: $count"
415

files/rvn_init

+29-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function bootstrap_node() {
2020
local download_dir=/kingofthenorth/bootstrap-seed/
2121
local extraction_dir=/kingofthenorth/raven-dir/
2222
local transmission_dir=~/.config/transmission-daemon/
23+
local bootstrap_done="bootstrap.done"
2324
while [ ! "$(transmission-remote localhost -n transmission:transmission -l | grep "rvn-bootstrap*.tar.gz" | awk '{print $5}')" = "Done" ];
2425
do
2526
echo -e "$(date) - Waiting for bootstrap file to finish downloading..." > ~/bootstrap-status.log
@@ -33,18 +34,26 @@ function bootstrap_node() {
3334
return 1
3435
fi
3536

37+
echo -e "$(date) - Verifying the bootstrap file integrity..." > ~/bootstrap-status.log
3638
cp ${transmission_dir}/seeding/rvn-bootstrap.md5 ${download_dir}
37-
pushd $download_dir
39+
pushd $download_dir &> /dev/null
3840
if ! md5sum -c rvn-bootstrap.md5 --status --ignore-missing; then
3941
echo -e "$(date) - ERROR: Failed to verify the MD5 checksum of the downloaded bootstrap file!" > ~/bootstrap-status.log
42+
popd &> /dev/null
4043
return 1
4144
fi
42-
popd
45+
popd &> /dev/null
46+
47+
if [ -f "${download_dir}/${bootstrap_done}" ]; then
48+
echo -e "$(date) - Extraction skipped since file already exists..." > ~/bootstrap-status.log
49+
return 0
50+
fi
4351

4452
echo -e "$(date) - Extracting the bootstrap file database..." > ~/bootstrap-status.log
4553
extract_file $bootstrap_file $extraction_dir || { echo -e "Failed to extract the bootstrap database..." > ~/bootstrap-status.log && return 1; }
4654

4755
echo -e "$(date) - Extraction of the bootstrap file completed succesfully!" > ~/bootstrap-status.log
56+
touch $bootstrap_done $download_dir
4857
return 0
4958
}
5059

@@ -84,13 +93,22 @@ function install_rvn() {
8493
}
8594

8695
function node_status() {
87-
local bootstrap_file="/home/kingofthenorth/bootstrap-status.log"
96+
local home_dir="/home/kingofthenorth"
97+
local bootstrap_file="${home_dir}/bootstrap-status.log"
8898
if [ -f $bootstrap_file ]; then
8999
cat $bootstrap_file
90100
fi
91101
local ravend_pid=$(ps aux | grep ravend | grep -v grep)
92102
if [ -n "${ravend_pid}" ]; then
93-
raven_status
103+
local status_file="node_status.log"
104+
local curr_t=$(date +%s)
105+
local status_file_t=$(date -r ${status_file} +%s)
106+
local diff_t=$[$curr_t - $status_file_t]
107+
if [ $diff_t -gt 60 ]; then
108+
raven_status > $status_file
109+
else
110+
cat $status_file
111+
fi
94112
fi
95113
return 0
96114
}
@@ -129,7 +147,13 @@ function init() {
129147
# Start bootstraping the node
130148
bootstrap_node || { sleep 600 && return 2; }
131149
# Start ravencoin daemon
132-
ravend || return 3
150+
local ravend_done="ravend-reindex.done"
151+
if [ -f "${ravend_done}" ]; then
152+
ravend || return 3
153+
else
154+
touch $ravend_done
155+
ravend -reindex || return 4
156+
fi
133157
}
134158

135159
$1

0 commit comments

Comments
 (0)