Skip to content

Commit

Permalink
fix start.sh db init
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspool1314 committed Sep 25, 2019
1 parent 0ad6af6 commit 877b68b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash

cd "$(dirname "$0")"
cd ..
rootpath=$(pwd)

# set default chain home path
defaultChainPath=~/blockdata
defaultChainPath=$rootpath

# default node type
defaultType="kv"
Expand All @@ -11,9 +15,8 @@ defaultType="kv"
emptyBlockInterval=300
blockInterval=1000

rootpath=$(dirname $(pwd))
proc=$rootpath/bin/lkchain
dbpath=$rootpath/init/db_kv
dbpath=$rootpath/init/db
datapath=$defaultChainPath/data
init_height=0
state_hash=""
Expand All @@ -36,7 +39,7 @@ function GetStateHash() {

function defaultInitSet() {
if [ $defaultType == "full" ]; then
dbpath=$rootpath/init/db_full
dbpath=$rootpath/init/db
state_path="$dbpath/full"
GetStateHash
ext_init_params="--full_node=true --init_state_root $state_hash"
Expand All @@ -46,19 +49,21 @@ function defaultInitSet() {

function downloadDB() {
if [ $defaultType == "full" ]; then
if [ ! -d "$rootpath/init/db_full" ]; then
if [ ! -d "$rootpath/init/db/full" ]; then
wget $full_initdb_url -O $rootpath/init/db_full.tar.gz
cd $rootpath/init/ && tar zxf db_full.tar.gz
fi
else
if [ ! -d "$rootpath/init/db_kv" ]; then
if [ ! -d "$rootpath/init/db/kv" ]; then
wget $kv_initdb_url -O $rootpath/init/db_kv.tar.gz
cd $rootpath/init/ && tar zxf db_kv.tar.gz
fi
fi
}

cd $rootpath


logpath=$datapath/logs

function Init() {
Expand Down

0 comments on commit 877b68b

Please sign in to comment.