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
$_config['sanity_rebroadcast_locals'] = true;
// Get more peers?
$_config['get_more_peers']=true;
/*
|--------------------------------------------------------------------------
| Logging Configuration

View File

@@ -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);