passive peering
This commit is contained in:
2
api.php
2
api.php
@@ -69,7 +69,7 @@ header('Content-Type: application/json');
|
||||
|
||||
use Arionum\Blacklist;
|
||||
|
||||
require_once("include/init.inc.php");
|
||||
require_once __DIR__.'/include/init.inc.php';
|
||||
error_reporting(0);
|
||||
$ip = san_ip($_SERVER['REMOTE_ADDR']);
|
||||
$ip = filter_var($ip, FILTER_VALIDATE_IP);
|
||||
|
||||
@@ -85,6 +85,10 @@ $_config['initial_peer_list'] = [
|
||||
'http://peer27.arionum.com',
|
||||
];
|
||||
|
||||
// does not peer with any of the peers. Uses the seed peers and syncs only from those peers. Requires a cronjob on sanity.php
|
||||
$_config['passive_peering'] = false;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mempool Configuration
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// ARO version
|
||||
define("VERSION", "0.4.2");
|
||||
define("VERSION", "0.4.3");
|
||||
// Amsterdam timezone by default, should probably be moved to config
|
||||
date_default_timezone_set("UTC");
|
||||
|
||||
@@ -14,14 +14,14 @@ if (php_sapi_name() !== 'cli' && substr_count($_SERVER['PHP_SELF'], "/") > 1) {
|
||||
}
|
||||
|
||||
require_once __DIR__.'/Exception.php';
|
||||
require_once("include/config.inc.php");
|
||||
require_once("include/db.inc.php");
|
||||
require_once("include/functions.inc.php");
|
||||
require_once __DIR__.'/config.inc.php';
|
||||
require_once __DIR__.'/db.inc.php';
|
||||
require_once __DIR__.'/functions.inc.php';
|
||||
require_once __DIR__.'/Blacklist.php';
|
||||
require_once __DIR__.'/InitialPeers.php';
|
||||
require_once("include/block.inc.php");
|
||||
require_once("include/account.inc.php");
|
||||
require_once("include/transaction.inc.php");
|
||||
require_once __DIR__.'/block.inc.php';
|
||||
require_once __DIR__.'/account.inc.php';
|
||||
require_once __DIR__.'/transaction.inc.php';
|
||||
|
||||
if ($_config['db_pass'] == "ENTER-DB-PASS") {
|
||||
die("Please update your config file and set your db password");
|
||||
@@ -77,7 +77,7 @@ if (file_exists("tmp/db-update")) {
|
||||
$res = unlink("tmp/db-update");
|
||||
if ($res) {
|
||||
echo "Updating db schema! Please refresh!\n";
|
||||
require_once("include/schema.inc.php");
|
||||
require_once __DIR__.'/schema.inc.php';
|
||||
exit;
|
||||
}
|
||||
echo "Could not access the tmp/db-update file. Please give full permissions to this file\n";
|
||||
|
||||
2
mine.php
2
mine.php
@@ -23,7 +23,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
require_once("include/init.inc.php");
|
||||
require_once __DIR__.'/include/init.inc.php';
|
||||
$block = new Block();
|
||||
$acc = new Account();
|
||||
set_time_limit(360);
|
||||
|
||||
2
peer.php
2
peer.php
@@ -23,7 +23,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
require_once("include/init.inc.php");
|
||||
require_once __DIR__.'/include/init.inc.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$trx = new Transaction();
|
||||
|
||||
@@ -24,7 +24,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
set_time_limit(360);
|
||||
require_once("include/init.inc.php");
|
||||
require_once __DIR__.'/include/init.inc.php';
|
||||
$block = new Block();
|
||||
|
||||
$type = san($argv[1]);
|
||||
|
||||
10
sanity.php
10
sanity.php
@@ -301,7 +301,15 @@ if ($total_peers == 0 && $_config['testnet'] == false) {
|
||||
continue;
|
||||
}
|
||||
$peered[$pid] = 1;
|
||||
|
||||
if($_config['passive_peering'] == true){
|
||||
// does not peer, just add it to DB in passive mode
|
||||
$db->run("INSERT into peers set hostname=:hostname, ping=0, reserve=0,ip=:ip",[":hostname"=>$peer, ":ip"=>md5($peer)]);
|
||||
$res=true;
|
||||
} else {
|
||||
// forces the other node to peer with us.
|
||||
$res = peer_post($peer."/peer.php?q=peer", ["hostname" => $_config['hostname'], "repeer" => 1]);
|
||||
}
|
||||
if ($res !== false) {
|
||||
$i++;
|
||||
echo "Peering OK - $peer\n";
|
||||
@@ -328,7 +336,7 @@ foreach ($r as $x) {
|
||||
_log("Contacting peer $x[hostname]");
|
||||
$url = $x['hostname']."/peer.php?q=";
|
||||
// get their peers list
|
||||
if ($_config['get_more_peers']==true) {
|
||||
if ($_config['get_more_peers']==true && $_config['passive_peering']!=true) {
|
||||
$data = peer_post($url."getPeers", [], 5);
|
||||
if ($data === false) {
|
||||
_log("Peer $x[hostname] unresponsive");
|
||||
|
||||
Reference in New Issue
Block a user