diff --git a/peer.php b/peer.php index f80abd8..368cc6b 100755 --- a/peer.php +++ b/peer.php @@ -188,7 +188,7 @@ elseif($q=="submitBlock"){ _log('['.$_SERVER['REMOTE_ADDR']."] block ok, repropagating - $data[height]"); // send it to all our peers -// system("php propagate.php block '$data[id]' all all linear > /dev/null 2>&1 &"); + system("php propagate.php block '$data[id]' all all linear > /dev/null 2>&1 &"); api_echo("block-ok"); } // return the current block, used in syncing diff --git a/propagate.php b/propagate.php index e5f527f..f0a65d5 100755 --- a/propagate.php +++ b/propagate.php @@ -52,7 +52,10 @@ if((empty($peer)||$peer=='all')&&$type=="block"){ $res=file_put_contents("tmp/$id",$data); if($res===false) die("Could not write the cache file"); // broadcasting to all peers - $r=$db->run("SELECT * FROM peers WHERE blacklisted < UNIX_TIMESTAMP() AND reserve=0"); + $ewhr=""; + // boradcasting to only certain peers + if($linear==true) $ewhr=" ORDER by RAND() LIMIT 5"; + $r=$db->run("SELECT * FROM peers WHERE blacklisted < UNIX_TIMESTAMP() AND reserve=0 $ewhr"); foreach($r as $x) { // encode the hostname in base58 and sanitize the IP to avoid any second order shell injections $host=base58_encode($x['hostname']); diff --git a/sanity.php b/sanity.php index 65f0940..0f4a197 100755 --- a/sanity.php +++ b/sanity.php @@ -396,6 +396,9 @@ if($current['height']<$largest_height&&$largest_height>1){ } +// deleting mempool transactions older than 14 days +$db->run("DELETE FROM `mempool` WHERE `date` < UNIX_TIMESTAMP()-(3600*24*14)"); + //rebroadcasting local transactions