Browse Source

update maturity dates to also give amount, now requires JSON.pm

master
Jonathan "Duke" Leto 6 years ago
parent
commit
6df6b9fdae
  1. 30
      bin/block_maturity_dates.pl

30
bin/block_maturity_dates.pl

@ -3,19 +3,31 @@
use strict;
use warnings;
use POSIX qw(strftime);
my $output = qx{./fiat/verus listtransactions "" 1000 |grep blockstomaturity | cut -d: -f2 | sed 's/,//g' | sort -n};
my @lines = split /\n/, $output;
use JSON;
chomp(my $host = `hostname`);
my $num_blocks = int( shift || 1000 );
my $output = qx{./fiat/verus listtransactions "" $num_blocks};
#my $output = qx{./fiat/verus listtransactions "" $blocks}; # |grep blockstomaturity | cut -d: -f2 | sed 's/,//g' | sort -n};
my $blocks = decode_json($output);
print "$host:\n";
my $num = 0;
for my $line (@lines) {
my $total = 0;
for my $block (@$blocks) {
next unless $block->{category} eq 'immature';
$num++;
chomp $line;
# my $date = localtime(time + 60*$line);
my $date = strftime "%a %b %e %H:%M:00 %Y", localtime(time + 60*$line);
print "$num $date\n";
my $amount = $block->{amount};
my $blockstomaturity = $block->{blockstomaturity};
my $date = strftime "%a %b %e %H:%M:00 %Y", localtime(time + 60*$blockstomaturity);
printf "%02d %s, %d\n", $num, $date, $amount;
$total += $amount;
}
print "Total: $num immature blocks\n";
#for my $line (@lines) {
# chomp $line;
# # my $date = localtime(time + 60*$line);
# my $date = strftime "%a %b %e %H:%M:00 %Y", localtime(time + 60*$line);
# print "$num $date\n";
#}
print "Total: $num immature blocks, $total VRSC\n";

Loading…
Cancel
Save