-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14603 from MinaProtocol/dkijania/port_log_precomp…
…uted_blocks_dev [Dev] port log precomputed blocks in local network script
- Loading branch information
Showing
2 changed files
with
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ $# -lt 1 ]]; then | ||
echo "Usage: $0 precomputed-log-file [output-folder]" | ||
exit 1 | ||
fi | ||
|
||
|
||
|
||
ARCHIVE_URI=${ARCHIVE_URI:-postgres://postgres@localhost:5432/archive} | ||
PRECOMPUTED_LOG_FILE=$1 | ||
|
||
while IFS= read -r line; do | ||
LEDGER_HASH=$(echo $line | jq -r '.protocol_state.body.blockchain_state.staged_ledger_hash.non_snark.ledger_hash') | ||
FILE_NAME=$(psql $ARCHIVE_URI -t -c "SELECT 'mainnet-' || height || '-' ||state_hash || '.json' FROM blocks WHERE ledger_hash = '$LEDGER_HASH'") | ||
echo $line > $FILE_NAME | ||
done < $PRECOMPUTED_LOG_FILE | ||
|
||
|
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