linear sync

This commit is contained in:
Arionum
2018-04-01 16:46:38 +03:00
parent a13c7285fd
commit 148c002f93
3 changed files with 8 additions and 6 deletions

View File

@@ -30,9 +30,10 @@ $block= new Block();
$type=san($argv[1]);
$id=san($argv[2]);
$debug=false;
$linear=false;
// if debug mode, all data is printed to console, no background processes
if(trim($argv[5])=='debug') $debug=true;
if(trim($argv[5])=='linear') $linear=true;
$peer=san(trim($argv[3]));
@@ -58,6 +59,7 @@ if((empty($peer)||$peer=='all')&&$type=="block"){
$ip=filter_var($x['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
// fork a new process to send the blocks async
if($debug) system("php propagate.php '$type' '$id' '$host' '$ip' debug");
elseif($linear) system("php propagate.php '$type' '$id' '$host' '$ip' linear");
else system("php propagate.php '$type' '$id' '$host' 'ip' > /dev/null 2>&1 &");
}
exit;
@@ -80,7 +82,7 @@ if($type=="block"){
$hostname=base58_decode($peer);
// send the block as POST to the peer
echo "Block sent to $hostname:\n";
$response= peer_post($hostname."/peer.php?q=submitBlock",$data,60,$debug);
$response= peer_post($hostname."/peer.php?q=submitBlock",$data,60, $debug);
if($response=="block-ok") { echo "Block $i accepted. Exiting.\n"; exit;}
elseif($response['request']=="microsync"){
// the peer requested us to send more blocks, as it's behind