You can now estimate future blocktimes of Arrakis Chains with: ./contrib/block_time.pl 5555555 DRAGONX
This commit is contained in:
@@ -7,14 +7,18 @@ use strict;
|
||||
|
||||
# Given a block time, estimate when it will happen
|
||||
my $block = shift || die "Usage: $0 123";
|
||||
my $coin = shift;
|
||||
my $hush = "./src/hush-cli";
|
||||
unless (-e $hush) {
|
||||
die "$hush does not exist, aborting";
|
||||
}
|
||||
if ($coin) {
|
||||
$hush .= " -ac_name=$coin";
|
||||
}
|
||||
my $blockcount = qx{$hush getblockcount};
|
||||
|
||||
unless ($blockcount = int($blockcount)) {
|
||||
print "Invalid response from hush-cli\n";
|
||||
print "Invalid response from $hush\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
@@ -22,13 +26,24 @@ if ($block <= $blockcount) {
|
||||
die "That block has already happened!";
|
||||
} else {
|
||||
my $diff = $block - $blockcount;
|
||||
my $minutes = $diff*1.25; # 75s in minutes
|
||||
my $minpb = 1.25; # 75s in minutes for HUSH3
|
||||
if ($coin eq 'DRAGONX') {
|
||||
$minpb = 0.6; # minutes per block
|
||||
} elsif ($coin) {
|
||||
# TODO: support custom bloctimes
|
||||
$minpb = 1; # assumes default blocktime of 60s
|
||||
}
|
||||
my $minutes = $diff*$minpb;
|
||||
my $seconds = $minutes*60;
|
||||
my $now = time;
|
||||
my $then = $now + $seconds;
|
||||
my $ldate = localtime($then);
|
||||
my $gmdate = gmtime($then);
|
||||
print "Hush Block $block will happen at roughly:\n";
|
||||
if ($coin) {
|
||||
print "$coin Block $block will happen at roughly:\n";
|
||||
} else {
|
||||
print "Hush Block $block will happen at roughly:\n";
|
||||
}
|
||||
print "$ldate Eastern # $then\n";
|
||||
print "$gmdate GMT # $then\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user