Skip to content
Permalink
Browse files

added some super hacky scripts to assist with syncing

  • Loading branch information
Alan Rudolf
Alan Rudolf committed Aug 20, 2017
1 parent c8ac131 commit 7d7e408b6c9e6692d5bef324e57b0c6a892d0899
Showing with 51 additions and 0 deletions.
  1. +25 −0 scripts/forcesync.sh
  2. +26 −0 scripts/forcesynclatest.sh
@@ -0,0 +1,25 @@
#!/bin/sh
# this super hack will sync the explorer within the specified block height range
forcesync() {
blockcount=$1
echo "╒══════════════════<<"
echo "| height : $blockcount"
blockhash=`curl -s https://explorer.chaincoin.org/api/getblockhash?height=$blockcount`
echo "| ଓ hash : $blockhash"
curl -s https://explorer.chaincoin.org/block/$blockhash > /dev/null
echo "╘═══════════════════════════════>>"
}

main() {
if [ $currentblockcount -ne $endingblockcount ]; then
forcesync $currentblockcount
currentblockcount=$((currentblockcount + 1))
else exit; fi
main
}

startingblockcount=1213133
endingblockcount=1213143
echo "Syncing..."
currentblockcount=$startingblockcount
main
@@ -0,0 +1,26 @@
#!/bin/sh
# this super hack will sync the explorer from the newest block as they occur
forcesync() {
blockcount=$1
echo "╒══════════════════<<"
echo "| height : $blockcount"
blockhash=`curl -s https://explorer.chaincoin.org/api/getblockhash?height=$blockcount`
echo "| ଓ hash : $blockhash"
curl -s https://explorer.chaincoin.org/block/$blockhash > /dev/null
echo "╘═══════════════════════════════>>"
}

main() {
echo "Checking for new block..."
previousblockcount=$currentblockcount
currentblockcount=`curl -s https://explorer.chaincoin.org/api/getblockcount`
if [ $currentblockcount -ne $previousblockcount ]; then
echo "New block found. Syncing..."
forcesync $currentblockcount
else echo "No new block found. Sleeping..."; fi
sleep 20
main
}

currentblockcount=0
main

0 comments on commit 7d7e408

Please sign in to comment.
You can’t perform that action at this time.