limit peers

This commit is contained in:
Arionum
2018-08-10 18:19:19 +03:00
parent 6651ff54fc
commit 07dcebd895
2 changed files with 6 additions and 3 deletions

View File

@@ -83,6 +83,9 @@ $_config['allow_hostname_change'] = false;
// Rebroadcast local transactions when running sanity // Rebroadcast local transactions when running sanity
$_config['sanity_rebroadcast_locals'] = true; $_config['sanity_rebroadcast_locals'] = true;
// Get more peers?
$_config['get_more_peers']=true;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Logging Configuration | Logging Configuration

View File

@@ -314,6 +314,7 @@ foreach ($r as $x) {
_log("Contacting peer $x[hostname]"); _log("Contacting peer $x[hostname]");
$url = $x['hostname']."/peer.php?q="; $url = $x['hostname']."/peer.php?q=";
// get their peers list // get their peers list
if($_config['get_more_peers']==true){
$data = peer_post($url."getPeers", [], 5); $data = peer_post($url."getPeers", [], 5);
if ($data === false) { if ($data === false) {
_log("Peer $x[hostname] unresponsive"); _log("Peer $x[hostname] unresponsive");
@@ -324,7 +325,6 @@ foreach ($r as $x) {
); );
continue; continue;
} }
$i = 0; $i = 0;
foreach ($data as $peer) { foreach ($data as $peer) {
// store the hostname as md5 hash, for easier checking // 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 // get the current block and check it's blockchain
$data = peer_post($url."currentBlock", [], 5); $data = peer_post($url."currentBlock", [], 5);