diff --git a/util/checkpoints.pl b/util/checkpoints.pl index a79ba2753..be6bf28be 100755 --- a/util/checkpoints.pl +++ b/util/checkpoints.pl @@ -7,16 +7,16 @@ use strict; # Generate checkpoint data for use in src/chainparams.cpp my $perday = 1152; -my $hush = "./src/hush-cli"; -my $gethash = "$hush getblockhash"; +my $cli = "./src/hush-cli"; +my $gethash = "$cli getblockhash"; my $stride = shift || 1000; if ($stride =~ m/help/) { print "To generate checkpoint data every 1000 blocks: $0 &> checkpoints.txt\n"; print "To generate checkpoint data every X blocks: $0 X &> checkpoints.txt\n"; print "To generate checkpoint data every X blocks starting at height Y: $0 X Y &> checkpoints.txt\n"; + print "To generate checkpoint data every X blocks starting at height Y for -ac_name CHAIN: $0 X Y CHAIN &> checkpoints.txt\n"; exit 0; } - unless ($stride == int($stride) and $stride >= 0) { print "Invalid stride! Must be an integer > 0\n"; exit 1; @@ -28,8 +28,17 @@ unless ($start_height == int($start_height) and $start_height >= 0) { exit 1; } +my $acname = shift; +if ($acname) { + # TODO: is acname valid? + $cli .= " -ac_name=$acname"; + # TODO: assumes all HSC's will have a blocktime of 60s + $perday = 1440; +} + + my $count = 0; -my $blocks = qx{$hush getblockcount}; +my $blocks = qx{$cli getblockcount}; if($?) { print "ERROR, exiting...\n"; exit 1; @@ -53,7 +62,7 @@ while (1) { chomp $blockhash; print qq{($block, uint256S("0x$blockhash"))\n}; } -my $time = qx{$hush getblock $last |grep time|cut -d: -f2| sed 's/,//g'}; +my $time = qx{$cli getblock $last |grep time|cut -d: -f2| sed 's/,//g'}; chomp($time); # TODO: This is Linux-only and assumes new (not legacy) dir my $line1 = qx{grep --text height=$prev ~/.hush/HUSH3/debug.log};