diff --git a/include/block.inc.php b/include/block.inc.php index f742859..f501877 100755 --- a/include/block.inc.php +++ b/include/block.inc.php @@ -267,10 +267,10 @@ $this->reset_fails_masternodes($mn_winner, $height, $hash); } }elseif($height>=80458){ $type=$height%2; - $current=$db->row("SELECT difficulty from blocks ORDER by height DESC LIMIT 1,1"); + $current=$db->row("SELECT difficulty from blocks WHERE height<=:h ORDER by height DESC LIMIT 1,1",[":h"=>$height]); $blks=0; $total_time=0; - $blk = $db->run("SELECT `date`, height FROM blocks ORDER by height DESC LIMIT 20"); + $blk = $db->run("SELECT `date`, height FROM blocks WHERE height<=:h ORDER by height DESC LIMIT 20",[":h"=>$height]); for ($i=0;$i<19;$i++) { $ctype=$blk[$i+1]['height']%2; $time=$blk[$i]['date']-$blk[$i+1]['date']; diff --git a/include/transaction.inc.php b/include/transaction.inc.php index 88ca382..d9c3494 100755 --- a/include/transaction.inc.php +++ b/include/transaction.inc.php @@ -378,6 +378,10 @@ class Transaction _log("The Masternode IP is invalid", 3); return false; } + $existing=$db->single("SELECT COUNT(1) FROM masternode WHERE public_key=:id or ip=:ip",["id"=>$x['public_key'], ":ip"=>$message]); + if($existing!=0){ + return false; + } } diff --git a/util.php b/util.php index 3fbb435..2b18278 100755 --- a/util.php +++ b/util.php @@ -93,7 +93,7 @@ elseif ($cmd == 'block-time') { } $time = $t - $x['date']; $t = $x['date']; - echo "$x[height] -> $time\n"; + echo "$x[height]\t\t$time\t\t$x[difficulty]\n"; $end = $x['date']; } echo "Average block time: ".ceil(($start - $end) / 100)." seconds\n";