Save checkpoints as individual .json files
This commit is contained in:
12
contrib/sda_checkpoints.pl
Normal file → Executable file
12
contrib/sda_checkpoints.pl
Normal file → Executable file
@@ -12,8 +12,8 @@ my $hush = "./src/hush-cli";
|
|||||||
my $getblock= "$hush getblock";
|
my $getblock= "$hush getblock";
|
||||||
my $gethash = "$hush getblockhash";
|
my $gethash = "$hush getblockhash";
|
||||||
my $gettree = "$hush getblockmerkletree";
|
my $gettree = "$hush getblockmerkletree";
|
||||||
my $start = shift || 1190000;
|
my $start = shift || 1390000;
|
||||||
my $end = shift || 1260000;
|
my $end = shift || 1422000;
|
||||||
my $stride = shift || 10000;
|
my $stride = shift || 10000;
|
||||||
|
|
||||||
my $blocks = qx{$hush getblockcount};
|
my $blocks = qx{$hush getblockcount};
|
||||||
@@ -41,8 +41,12 @@ while (1) {
|
|||||||
chomp $merkle;
|
chomp $merkle;
|
||||||
chomp $blockhash;
|
chomp $blockhash;
|
||||||
chomp $blocktime;
|
chomp $blocktime;
|
||||||
$blocktime =~ s/^\s+|\s+$//g ;
|
$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;
|
$block += $stride;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user