-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathassetchains
executable file
·34 lines (32 loc) · 1.43 KB
/
assetchains
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# deprecated now, still useful to start one chain...
cd "${BASH_SOURCE%/*}" || exit
rm restart_queue > /dev/null 2>&1
pubkey=$(./printkey.py pub)
overide_args="${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9}"
ac_json=$(cat assetchains.json)
branch()
{
branch="master"
attempt=$(jq -r --arg chain ${1} '.[] | select (.ac_name == $chain) | .branch' <<<"${ac_json}")
if [[ ${attempt} != "null" ]] && [[ ${attempt} != "" ]]; then
branch=${attempt}
fi
echo ${branch}
}
while read -r args; do
chain=$(grep -o 'ac_name=[^ ,]\+' <<<"${args}")
chain=$(echo "${chain#*=}")
iguana=$(jq -r --arg chain "${chain}" '.[] | select (.ac_name == $chain) | .iguana' <<<"${ac_json}")
rpc=$(jq -r --arg chain "${chain}" '.[] | select (.ac_name == $chain) | .iguana_rpc' <<<"${ac_json}")
conf="${HOME}/.komodo/${chain}/${chain}.conf"
if [[ "${iguana}" == "blackjok3r" ]];then
if [[ -f "${conf}" ]]; then
sed -i '/blocknotify/d' "${conf}"
echo "blocknotify=curl -s --url \"http://127.0.0.1:${rpc}\" --data \"{\\\"agent\\\":\\\"dpow\\\",\\\"method\\\":\\\"updatechaintip\\\",\\\"blockhash\\\":\\\"%s\\\",\\\"symbol\\\":\\\"${chain}\\\"}\"" >> ${conf}
else
echo "${chain}" >> restart_queue
fi
fi
screen -S ${chain} -d -m ${HOME}/LabsNotary/komodo/$(branch ${chain})/komodod ${args} -pubkey=${pubkey} ${overide_args} &
done < <(./listassetchainparams.py ${1})