1
0
mirror of https://github.com/fluencelabs/tendermint synced 2025-07-26 01:31:56 +00:00
Files
.circleci
.github
DOCKER
benchmarks
blockchain
cmd
config
consensus
docs
evidence
lite
mempool
node
p2p
proxy
rpc
scripts
state
test
app
circleci
docker
p2p
atomic_broadcast
basic
data
fast_sync
check_peer.sh
test.sh
test_peer.sh
kill_all
pex
README.md
clean.sh
client.sh
ip.sh
ip_plus_id.sh
local_testnet_start.sh
local_testnet_stop.sh
peer.sh
persistent_peers.sh
test.sh
persist
utils
README.md
test_cover.sh
test_libs.sh
types
version
wire
.editorconfig
.gitignore
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
Vagrantfile
appveyor.yml
codecov.yml
tendermint/test/p2p/fast_sync/check_peer.sh

44 lines
1.0 KiB
Bash
Raw Normal View History

2016-12-06 23:16:41 -05:00
#! /bin/bash
set -eu
set -o pipefail
ID=$1
2016-12-12 16:00:21 -05:00
###########################################
#
# Wait for peer to catchup to other peers
#
###########################################
2016-12-06 23:16:41 -05:00
addr=$(test/p2p/ip.sh $ID):46657
peerID=$(( $(($ID % 4)) + 1 )) # 1->2 ... 3->4 ... 4->1
peer_addr=$(test/p2p/ip.sh $peerID):46657
# get another peer's height
2017-04-28 22:31:30 -04:00
h1=`curl -s $peer_addr/status | jq .result.latest_block_height`
2016-12-06 23:16:41 -05:00
# get another peer's state
2017-04-28 22:31:30 -04:00
root1=`curl -s $peer_addr/status | jq .result.latest_app_hash`
2016-12-06 23:16:41 -05:00
echo "Other peer is on height $h1 with state $root1"
echo "Waiting for peer $ID to catch up"
# wait for it to sync to past its previous height
set +e
set +o pipefail
h2="0"
while [[ "$h2" -lt "$(($h1+3))" ]]; do
sleep 1
2017-04-28 22:31:30 -04:00
h2=`curl -s $addr/status | jq .result.latest_block_height`
2016-12-06 23:16:41 -05:00
echo "... $h2"
done
# check the app hash
2017-04-28 22:31:30 -04:00
root2=`curl -s $addr/status | jq .result.latest_app_hash`
2016-12-06 23:16:41 -05:00
if [[ "$root1" != "$root2" ]]; then
echo "App hash after fast sync does not match. Got $root2; expected $root1"
exit 1
fi
echo "... fast sync successful"