From 0fb9db169cd293a51ade5d1ffe4a56f372335d91 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 19 Sep 2022 13:12:37 -0400 Subject: [PATCH] Basic CLI help and error checking for a valid stride --- util/checkpoints.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util/checkpoints.pl b/util/checkpoints.pl index 5b49c2b3e..b5eca7109 100755 --- a/util/checkpoints.pl +++ b/util/checkpoints.pl @@ -10,6 +10,16 @@ my $perday = 1152; my $hush = "./src/hush-cli"; my $gethash = "$hush 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"; + exit 0; +} + +unless ($stride == int($stride) and $stride >= 0) { + print "Invalid stride! Must be an integer > 0\n"; + exit 1; +} my $count = 0; my $blocks = qx{$hush getblockcount}; if($?) {