mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-30 17:54:32 +01:00
Optimized db with new indexes, added rawtx db
This commit is contained in:
@@ -10,37 +10,39 @@ export DB_PATH
|
||||
export DB_FILE
|
||||
|
||||
trim() {
|
||||
echo -e "$1" | sed -e 's/^[[:space:]]*//' | sed -e 's/[[:space:]]*$//'
|
||||
echo -e "$1" | sed -e 's/^[[:space:]]*//' | sed -e 's/[[:space:]]*$//'
|
||||
}
|
||||
|
||||
createCurlConfig() {
|
||||
|
||||
if [[ ''$1 == '' ]]; then
|
||||
echo "Missing file name: Check you *_BTC_NODE_RPC_CFG"
|
||||
return
|
||||
fi
|
||||
if [[ ''$1 == '' ]]; then
|
||||
echo "Missing file name: Check your *_BTC_NODE_RPC_CFG"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ''$2 == '' ]]; then
|
||||
echo "Missing content: Check you *_BTC_NODE_RPC_USER"
|
||||
return
|
||||
fi
|
||||
if [[ ''$2 == '' ]]; then
|
||||
echo "Missing content: Check your *_BTC_NODE_RPC_USER"
|
||||
return
|
||||
fi
|
||||
|
||||
local user=$( trim $2 )
|
||||
echo "user=${user}" > ${1}
|
||||
local user=$( trim $2 )
|
||||
echo "user=${user}" > ${1}
|
||||
|
||||
}
|
||||
|
||||
if [ ! -e ${DB_FILE} ]; then
|
||||
echo "DB not found, creating..."
|
||||
cat cyphernode.sql | sqlite3 $DB_FILE
|
||||
echo "DB not found, creating..."
|
||||
cat cyphernode.sql | sqlite3 $DB_FILE
|
||||
cat rawtx.sql | sqlite3 ${DB_FILE}_rawtx
|
||||
else
|
||||
echo "DB found, migrating..."
|
||||
for script in sqlmigrate*.sh; do
|
||||
sh $script
|
||||
done
|
||||
echo "DB found, migrating..."
|
||||
for script in sqlmigrate*.sh; do
|
||||
sh $script
|
||||
done
|
||||
fi
|
||||
|
||||
chmod 0600 $DB_FILE
|
||||
chmod 0600 ${DB_FILE}_rawtx
|
||||
|
||||
createCurlConfig ${WATCHER_BTC_NODE_RPC_CFG} ${WATCHER_BTC_NODE_RPC_USER}
|
||||
createCurlConfig ${SPENDER_BTC_NODE_RPC_CFG} ${SPENDER_BTC_NODE_RPC_USER}
|
||||
|
||||
Reference in New Issue
Block a user