untested hf

This commit is contained in:
admin@arionum.com
2019-09-05 03:52:42 +03:00
parent 751ca8dd19
commit 027b36fce8
5 changed files with 377 additions and 202 deletions

View File

@@ -472,7 +472,11 @@ elseif ($cmd == 'get-address') {
if (empty($alias)) {
$alias="A";
}
$rec=$db->single("SELECT SUM(val) FROM transactions WHERE (dst=:id or dst=:alias) AND (height<80000 OR (version!=100 AND version!=103)) and version<111", [":id"=>$x['id'], ":alias"=>$alias]);
$rec=$db->single("SELECT SUM(val) FROM transactions WHERE (dst=:id or dst=:alias) AND (height<80000 OR version!=100) and version<111", [":id"=>$x['id'], ":alias"=>$alias]);
$releases=$db->single("SELECT COUNT(1) FROM transactions WHERE dst=:id AND version=103", [":id"=>$x['id']]);
if ($releases>0) { //masternode releases
$rec+=$releases*100000;
}
$spent=$db->single("SELECT SUM(val+fee) FROM transactions WHERE public_key=:pub AND version>0", [":pub"=>$x['public_key']]);
if ($spent==false) {
$spent=0;
@@ -539,7 +543,7 @@ elseif ($cmd == 'get-address') {
echo "Hash:\t\t".md5(json_encode($res))."\n\n";
} elseif ($cmd == "version") {
echo "\n\n".VERSION."\n\n";
} elseif ($cmd == "sendblock"){
} elseif ($cmd == "sendblock") {
$peer=trim($argv[3]);
if (!filter_var($peer, FILTER_VALIDATE_URL)) {
die("Invalid peer hostname");
@@ -550,13 +554,12 @@ elseif ($cmd == 'get-address') {
$data = $block->export("", $height);
if($data===false){
if ($data===false) {
die("Could not find this block");
}
$response = peer_post($peer."/peer.php?q=submitBlock", $data, 60, true);
var_dump($response);
}elseif ($cmd == "recheck-external-blocks") {
} elseif ($cmd == "recheck-external-blocks") {
$peer=trim($argv[2]);
if (!filter_var($peer, FILTER_VALIDATE_URL)) {
die("Invalid peer hostname");
@@ -570,10 +573,10 @@ elseif ($cmd == 'get-address') {
$last=peer_post($peer."/peer.php?q=currentBlock");
$b=peer_post($peer."/peer.php?q=getBlock",["height"=>$height]);
$b=peer_post($peer."/peer.php?q=getBlock", ["height"=>$height]);
for ($i = $height+1; $i <= $last['height']; $i++) {
$c=peer_post($peer."/peer.php?q=getBlock",["height"=>$i]);
$c=peer_post($peer."/peer.php?q=getBlock", ["height"=>$i]);
if (!$block->mine(
$c['public_key'],
@@ -586,12 +589,10 @@ elseif ($cmd == 'get-address') {
)) {
print("Invalid block detected. $c[height] - $c[id]\n");
break;
}
}
echo "Block $i -> ok\n";
$b=$c;
}
} else {
echo "Invalid command\n";
}