Allow custom starting height to generate checkpoint data

This commit is contained in:
Duke Leto
2022-09-19 13:16:20 -04:00
parent 0fb9db169c
commit 92b387baed

View File

@@ -13,6 +13,7 @@ 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";
exit 0;
}
@@ -20,6 +21,13 @@ unless ($stride == int($stride) and $stride >= 0) {
print "Invalid stride! Must be an integer > 0\n";
exit 1;
}
my $start_height = shift || 0;
unless ($start_height == int($start_height) and $start_height >= 0) {
print "Invalid start_height! Must be an integer > 0\n";
exit 1;
}
my $count = 0;
my $blocks = qx{$hush getblockcount};
if($?) {
@@ -35,7 +43,7 @@ print "// Generated at $now via hush3 util/checkpoints.pl by Duke Leto\n";
while (1) {
$count++;
my $block = $stride*$count;
my $block = $start_height + $stride*$count;
if ($block > $blocks) {
$last = $stride*($count-1);
#print "last checkpointed block=$last\n";