kbs1 background process fix
This commit is contained in:
2
mine.php
2
mine.php
@@ -56,7 +56,7 @@ if($q=="info"){
|
|||||||
|
|
||||||
if($res){
|
if($res){
|
||||||
$current=$block->current();
|
$current=$block->current();
|
||||||
system("php propagate.php block $current[id] &>/dev/null &");
|
system("php propagate.php block $current[id] > /dev/null 2>&1 &");
|
||||||
api_echo("accepted");
|
api_echo("accepted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
peer.php
8
peer.php
@@ -107,7 +107,7 @@ elseif($q=="submitTransaction"){
|
|||||||
$trx->add_mempool($data, $_SERVER['REMOTE_ADDR']);
|
$trx->add_mempool($data, $_SERVER['REMOTE_ADDR']);
|
||||||
|
|
||||||
$res=$db->row("SELECT COUNT(1) as c, sum(val) as v FROM mempool ",array(":src"=>$data['src']));
|
$res=$db->row("SELECT COUNT(1) as c, sum(val) as v FROM mempool ",array(":src"=>$data['src']));
|
||||||
if($res['c']<$_config['max_mempool_rebroadcast']&&$res['v']/$res['c']<$data['val']) system("php propagate.php transaction '$data[id]' &>/dev/null &");
|
if($res['c']<$_config['max_mempool_rebroadcast']&&$res['v']/$res['c']<$data['val']) system("php propagate.php transaction '$data[id]' > /dev/null 2>&1 &");
|
||||||
api_echo("transaction-ok");
|
api_echo("transaction-ok");
|
||||||
}
|
}
|
||||||
elseif($q=="submitBlock"){
|
elseif($q=="submitBlock"){
|
||||||
@@ -127,7 +127,7 @@ elseif($q=="submitBlock"){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($accept_new){
|
if($accept_new){
|
||||||
system("php sanity.php microsanity '$ip' &>/dev/null &");
|
system("php sanity.php microsanity '$ip' > /dev/null 2>&1 &");
|
||||||
api_echo("microsanity");
|
api_echo("microsanity");
|
||||||
} else api_echo("reverse-microsanity");
|
} else api_echo("reverse-microsanity");
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ elseif($q=="submitBlock"){
|
|||||||
$pr=$db->row("SELECT * FROM peers WHERE ip=:ip",array(":ip"=>$ip));
|
$pr=$db->row("SELECT * FROM peers WHERE ip=:ip",array(":ip"=>$ip));
|
||||||
if(!$pr) api_err("block-too-old");
|
if(!$pr) api_err("block-too-old");
|
||||||
$peer_host=base58_encode($pr['hostname']);
|
$peer_host=base58_encode($pr['hostname']);
|
||||||
system("php propagate.php block current '$peer_host' '$pr[ip]' &>/dev/null &");
|
system("php propagate.php block current '$peer_host' '$pr[ip]' > /dev/null 2>&1 &");
|
||||||
api_err("block-too-old");
|
api_err("block-too-old");
|
||||||
}
|
}
|
||||||
if($data['height']-$current['height']>150) api_err("block-out-of-sync");
|
if($data['height']-$current['height']>150) api_err("block-out-of-sync");
|
||||||
@@ -151,7 +151,7 @@ elseif($q=="submitBlock"){
|
|||||||
if(!$res) api_err("invalid-block-data");
|
if(!$res) api_err("invalid-block-data");
|
||||||
api_echo("block-ok");
|
api_echo("block-ok");
|
||||||
|
|
||||||
system("php propagate.php block '$data[id]' &>/dev/null &");
|
system("php propagate.php block '$data[id]' > /dev/null 2>&1 &");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ if((empty($peer)||$peer=='all')&&$type=="block"){
|
|||||||
$host=base58_encode($x['hostname']);
|
$host=base58_encode($x['hostname']);
|
||||||
$ip=filter_var($x['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
$ip=filter_var($x['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
||||||
if($debug) system("php propagate.php '$type' '$id' '$host' '$ip' debug");
|
if($debug) system("php propagate.php '$type' '$id' '$host' '$ip' debug");
|
||||||
else system("php propagate.php '$type' '$id' '$host' 'ip' &>/dev/null &");
|
else system("php propagate.php '$type' '$id' '$host' 'ip' > /dev/null 2>&1 &");
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ if($type=="block"){
|
|||||||
$ip=trim($argv[4]);
|
$ip=trim($argv[4]);
|
||||||
$ip=filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
$ip=filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
||||||
if(empty($ip)) die("Invalid IP");
|
if(empty($ip)) die("Invalid IP");
|
||||||
system("php sanity.php microsanity '$ip' &>/dev/null &");
|
system("php sanity.php microsanity '$ip' > /dev/null 2>&1 &");
|
||||||
}
|
}
|
||||||
else echo "Block not accepted!\n";
|
else echo "Block not accepted!\n";
|
||||||
|
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ $forgotten=$current['height']-$_config['sanity_rebroadcast_height'];
|
|||||||
$r=$db->run("SELECT id FROM mempool WHERE height<:forgotten ORDER by val DESC LIMIT 10",array(":forgotten"=>$forgotten));
|
$r=$db->run("SELECT id FROM mempool WHERE height<:forgotten ORDER by val DESC LIMIT 10",array(":forgotten"=>$forgotten));
|
||||||
foreach($r as $x){
|
foreach($r as $x){
|
||||||
$x['id']=san($x['id']);
|
$x['id']=san($x['id']);
|
||||||
system("php propagate.php transaction $x[id] &>/dev/null &");
|
system("php propagate.php transaction $x[id] > /dev/null 2>&1 &");
|
||||||
$db->run("UPDATE mempool SET height=:current WHERE id=:id",array(":id"=>$x['id'], ":current"=>$current['height']));
|
$db->run("UPDATE mempool SET height=:current WHERE id=:id",array(":id"=>$x['id'], ":current"=>$current['height']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
util.php
8
util.php
@@ -140,6 +140,14 @@ echo "Mempool size: $res\n";
|
|||||||
$res=$db->row("SELECT * FROM blocks WHERE id=:id OR height=:id2 LIMIT 1",array(":id"=>$id, ":id2"=>$id));
|
$res=$db->row("SELECT * FROM blocks WHERE id=:id OR height=:id2 LIMIT 1",array(":id"=>$id, ":id2"=>$id));
|
||||||
|
|
||||||
var_dump($res);
|
var_dump($res);
|
||||||
|
}elseif($cmd=="check-address"){
|
||||||
|
$dst=trim($argv[2]);
|
||||||
|
$acc=new Account;
|
||||||
|
if(!$acc->valid($dst)) die("Invalid address");
|
||||||
|
$dst_b=base58_decode($dst);
|
||||||
|
if(strlen($dst_b)!=64) die("Invalid address - ".strlen($dst_b)." bytes");
|
||||||
|
|
||||||
|
echo "The address is valid\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "Invalid command\n";
|
echo "Invalid command\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user