Merge branch 'master' of github.com:ariochain/node

This commit is contained in:
Ario
2019-09-18 08:08:47 +02:00
2 changed files with 15 additions and 6 deletions

View File

@@ -114,7 +114,7 @@ $_config['use_official_blacklist'] = true;
*/
// Recheck the last blocks on sanity
$_config['sanity_recheck_blocks'] = 10;
$_config['sanity_recheck_blocks'] = 30;
// The interval to run the sanity in seconds
$_config['sanity_interval'] = 900;

View File

@@ -374,6 +374,8 @@ foreach ($r as $x) {
if ($test !== false) {
$total_peers++;
echo "Peered with: $peer[hostname]\n";
// a single new peer per sanity
$_config['get_more_peers']==false;
}
}
}
@@ -382,6 +384,13 @@ foreach ($r as $x) {
// get the current block and check it's blockchain
$data = peer_post($url."currentBlock", [], 5);
if ($data === false) {
_log("Peer $x[hostname] unresponsive");
// if the peer is unresponsive, mark it as failed and blacklist it for a while
$db->run(
"UPDATE peers SET fails=fails+1, blacklisted=UNIX_TIMESTAMP()+((fails+1)*3600) WHERE id=:id",
[":id" => $x['id']]
);
continue;
}
// peer was responsive, mark it as good
@@ -484,14 +493,14 @@ if ($current['height'] < $largest_height && $largest_height > 1) {
//if we're not on the same blockchain and also it's not the most common, verify all the blocks on on this blockchain starting at current-30 until current
$invalid = false;
$last_good = $current['height'];
for ($i = $current['height'] - 30; $i < $current['height']; $i++) {
for ($i = $current['height'] - 100; $i < $current['height']; $i++) {
$data = peer_post($url."getBlock", ["height" => $i]);
if ($data === false) {
$invalid = true;
break;
}
$ext = $block->get($i);
if ($i == $current['height'] - 30 && $ext['id'] != $data['id']) {
if ($i == $current['height'] - 100 && $ext['id'] != $data['id']) {
$invalid = true;
break;
}
@@ -617,7 +626,7 @@ if ($current['height'] < $largest_height && $largest_height > 1) {
$to_remove=intval($argv[2]);
}
_log("Removing $to_remove blocks, the blockchain is stale.");
$block->pop(to_remove);
$block->pop($to_remove);
$resyncing=true;
} elseif ($current['date']<time()-(3600*24)) {
_log("Removing 200 blocks, the blockchain is stale.");
@@ -822,7 +831,7 @@ if ($_config['masternode']==true&&!empty($_config['masternode_public_key'])&&!em
if ($f) {
$res=json_decode($f, true);
$res=$res['data'];
if ($res['height']<$current['height']-360) {
if ($res['height']<$current['height']-360) {
$blacklist=1;
}
echo "Masternode Height: ".$res['height']."\n";
@@ -878,4 +887,4 @@ if ($_config['masternode']==true&&!empty($_config['masternode_public_key'])&&!em
_log("Finishing sanity");
@unlink(SANITY_LOCK_PATH);
@unlink(SANITY_LOCK_PATH);