From 07dcebd8957bfc528e56c695b617c6a27faca16d Mon Sep 17 00:00:00 2001 From: Arionum Date: Fri, 10 Aug 2018 18:19:19 +0300 Subject: [PATCH] limit peers --- include/config-sample.inc.php | 3 +++ sanity.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/config-sample.inc.php b/include/config-sample.inc.php index 591e86b..ebf5cc8 100755 --- a/include/config-sample.inc.php +++ b/include/config-sample.inc.php @@ -83,6 +83,9 @@ $_config['allow_hostname_change'] = false; // Rebroadcast local transactions when running sanity $_config['sanity_rebroadcast_locals'] = true; +// Get more peers? +$_config['get_more_peers']=true; + /* |-------------------------------------------------------------------------- | Logging Configuration diff --git a/sanity.php b/sanity.php index 5debf50..1c504e8 100755 --- a/sanity.php +++ b/sanity.php @@ -314,7 +314,8 @@ foreach ($r as $x) { _log("Contacting peer $x[hostname]"); $url = $x['hostname']."/peer.php?q="; // get their peers list - $data = peer_post($url."getPeers", [], 5); +if($_config['get_more_peers']==true){ + $data = peer_post($url."getPeers", [], 5); if ($data === false) { _log("Peer $x[hostname] unresponsive"); // if the peer is unresponsive, mark it as failed and blacklist it for a while @@ -324,7 +325,6 @@ foreach ($r as $x) { ); continue; } - $i = 0; foreach ($data as $peer) { // store the hostname as md5 hash, for easier checking @@ -371,7 +371,7 @@ foreach ($r as $x) { } } } - +} // get the current block and check it's blockchain $data = peer_post($url."currentBlock", [], 5);