Save checkpoints as individual .json files

This commit is contained in:
fekt
2023-07-09 11:49:55 -04:00
parent 803e1d0f21
commit e53220b5f1

10
contrib/sda_checkpoints.pl Normal file → Executable file
View File

@@ -12,8 +12,8 @@ my $hush = "./src/hush-cli";
my $getblock= "$hush getblock";
my $gethash = "$hush getblockhash";
my $gettree = "$hush getblockmerkletree";
my $start = shift || 1190000;
my $end = shift || 1260000;
my $start = shift || 1390000;
my $end = shift || 1422000;
my $stride = shift || 10000;
my $blocks = qx{$hush getblockcount};
@@ -42,7 +42,11 @@ while (1) {
chomp $blockhash;
chomp $blocktime;
$blocktime =~ s/^\s+|\s+$//g;
print qq{{\n\t"network": "main",\n\t"height": "$block",\n\t"hash": "$blockhash",\n\t$blocktime\n\t"saplingTree": "$merkle"\n},\n};
my $checkpoint = qq{{\n\t"network": "main",\n\t"height": "$block",\n\t"hash": "$blockhash",\n\t$blocktime\n\t"saplingTree": "$merkle"\n}\n};
my $filename = "$block.json";
open(FH, '>', $filename) or die $!;
print FH $checkpoint;
close(FH);
$block += $stride;
}