aboutsummaryrefslogtreecommitdiff
path: root/enter
blob: 23036d513af91933e7daab9367e18c23325efe5c (plain)
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
entrance="$(cat $ZLATEST)"
#entrance="QmW5WVXCJfhb4peHG6cbEdamC24vZzMX2Vz386vpENh38U"
#entrance="QmNjQq7GkuXGF8kFT1z2Mv3i4JhY7sBXVUmHDiR1zkQjoE"
#entrance="QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH"
end="QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH"
previous="$entrance"
while true
do
	if [ ! -v $previous ]
	then
		if [ "$previous" != "$end" ]
		then
			ipfs cat $previous | json2bash > tmp-zblock
			source tmp-zblock
			ipfs cat $block | json2bash > tmp-block
			source tmp-block
			if [ -v $previous ]
			then
				echo "$block has no previous zblock"
				exit 3
			else
				echo "$block after $previous"
			fi
		elif [ "$previous" == "$end" ]
		then
			echo "$previous is GENESIS block"
			exit 0
		fi
	else 
		echo "Check not passed... No previous IPFS CID"
		exit 1
	fi
done