-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add script to check for blocks in chain logs
Co-authored-by: Dan Connolly <[email protected]>
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# Function to check if we see a pattern of block commits | ||
check_block_pattern() { | ||
local count=0 | ||
local required_patterns=3 # Number of block patterns we want to see | ||
|
||
while IFS= read -r line; do | ||
echo -n "." # Show progress | ||
|
||
if [[ $line =~ "block-manager: block "[0-9]+" commit" ]]; then | ||
((count++)) | ||
if [ $count -ge $required_patterns ]; then | ||
echo | ||
echo "$line" | ||
return 0 # Success | ||
fi | ||
fi | ||
done | ||
|
||
return 1 # Pattern not found | ||
} | ||
|
||
echo "Waiting for blockchain to start..." | ||
yarn docker:logs | check_block_pattern | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Blockchain is running and producing blocks..." | ||
exit 0 | ||
else | ||
echo "Failed to detect blockchain activity\n Run yarn start:docker to start the blockchain first!" | ||
exit 1 | ||
fi |