Optimized db with new indexes, added rawtx db

This commit is contained in:
kexkey
2021-10-07 12:43:53 -04:00
parent f1fe6df07d
commit 23caf87e30
10 changed files with 141 additions and 24 deletions

View File

@@ -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}