paranoid and blacklist

This commit is contained in:
admin@arionum.com
2018-09-05 16:06:23 +03:00
parent a03484adee
commit 0b73adb3d8
9 changed files with 119 additions and 25 deletions

View File

@@ -276,7 +276,7 @@ class Block
// before mnn hf
if ($height<80000) {
// elapsed time between the last 20 blocks
$first = $db->row("SELECT `date` FROM blocks ORDER by height DESC LIMIT $limit,1");
$first = $db->row("SELECT `date` FROM blocks ORDER by height DESC LIMIT :limit,1",[":limit"=>$limit]);
$time = $current['date'] - $first['date'];
// avg block time
@@ -566,8 +566,8 @@ class Block
}
_log("We have masternodes to blacklist - $tem", 2);
$ban=$db->run(
"SELECT public_key, blacklist, fails, last_won FROM masternode WHERE status=1 AND blacklist<:current AND height<:start ORDER by last_won ASC, public_key ASC LIMIT 0,$tem",
[":current"=>$last['height'], ":start"=>$last['height']-360]
"SELECT public_key, blacklist, fails, last_won FROM masternode WHERE status=1 AND blacklist<:current AND height<:start ORDER by last_won ASC, public_key ASC LIMIT 0,:limit",
[":current"=>$last['height'], ":start"=>$last['height']-360, ":limit"=>$tem]
);
_log(json_encode($ban));
$i=0;
@@ -689,8 +689,8 @@ class Block
$tem=floor(($time-$last_time)/600);
}
$winner=$db->single(
"SELECT public_key FROM masternode WHERE status=1 AND blacklist<:current AND height<:start ORDER by last_won ASC, public_key ASC LIMIT $tem,1",
[":current"=>$current_height, ":start"=>$current_height-360]
"SELECT public_key FROM masternode WHERE status=1 AND blacklist<:current AND height<:start ORDER by last_won ASC, public_key ASC LIMIT :tem,1",
[":current"=>$current_height, ":start"=>$current_height-360, ":tem"=>$tem]
);
_log("Moving to the next masternode - $tem - $winner", 1);
// if all masternodes are dead, give the block to gpu

View File

@@ -38,6 +38,10 @@ $_config['allowed_hosts'] = [
'127.0.0.1',
];
// Disable transactions and block repropagation
$_config['disable_repropagation'] = false;
/*
|--------------------------------------------------------------------------
| Peer Configuration
@@ -65,6 +69,9 @@ $_config['max_mempool_rebroadcast'] = 5000;
// The number of blocks between rebroadcasting transactions
$_config['sanity_rebroadcast_height'] = 30;
// Block accepting transfers from addresses blacklisted by the Arionum devs
$_config['use_official_blacklist'] = true;
/*
|--------------------------------------------------------------------------
| Sanity Configuration

View File

@@ -218,10 +218,21 @@ class Transaction
public function add_mempool($x, $peer = "")
{
global $db;
global $_config;
$block = new Block();
if ($x['version']>110) {
return true;
}
if ($_config['use_official_blacklist']!==false) {
$blacklisted=[
"PZ8Tyr4Nx8MHsRAGMpZmZ6TWY63dXWSCvVQcHHCNLfiP9LmzWhhpCHx39Bhc67P5HMQM9cctEFvcsUdgrkGqy18taz9ZMrAGtq7NhBYpQ4ZTHkKYiZDaSUqQ", //faucet abuser
"PZ8Tyr4Nx8MHsRAGMpZmZ6TWY63dXWSCxYDeQHk7Ke66UB2Un3UMmMoJ7RF5vDZXihdEXi8gk8ZBRAi35aFrER2ZLX1mgND7sLFXKETGTjRYjoHcuRNiJN1g" // octaex
];
if (in_array($public_key, $blacklisted)) {
return true;
}
}
$current = $block->current();
$height = $current['height'];
$x['id'] = san($x['id']);