From 409bd36906b18730de9d8807c8bb488f8b6f4515 Mon Sep 17 00:00:00 2001 From: Arionum Date: Fri, 12 Jan 2018 17:11:42 +0200 Subject: [PATCH] sync issues --- peer.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/peer.php b/peer.php index 2d73c21..dc5b082 100755 --- a/peer.php +++ b/peer.php @@ -125,7 +125,13 @@ elseif($q=="submitBlock"){ } if($current['height']!=$data['height']-1) { - if($data['height']<$current['height']) api_err("block-too-old"); + if($data['height']<$current['height']){ + $pr=$db->row("SELECT * FROM peers WHERE ip=:ip",array(":ip"=>$ip)); + if(!$pr) api_err("block-too-old"); + $peer_host=base58_encode($pr['hostname']); + system("php propagate.php block current '$peer_host' '$pr[ip]' &>/dev/null &"); + api_err("block-too-old"); + } if($data['height']-$current['height']>150) api_err("block-out-of-sync"); api_echo(array("request"=>"microsync","height"=>$current['height'], "block"=>$current['id']));