delete stuck transactions from mempool

This commit is contained in:
Arionum
2018-04-01 17:29:00 +03:00
parent 148c002f93
commit a5ec44dd6d
3 changed files with 8 additions and 2 deletions

View File

@@ -52,7 +52,10 @@ if((empty($peer)||$peer=='all')&&$type=="block"){
$res=file_put_contents("tmp/$id",$data);
if($res===false) die("Could not write the cache file");
// broadcasting to all peers
$r=$db->run("SELECT * FROM peers WHERE blacklisted < UNIX_TIMESTAMP() AND reserve=0");
$ewhr="";
// boradcasting to only certain peers
if($linear==true) $ewhr=" ORDER by RAND() LIMIT 5";
$r=$db->run("SELECT * FROM peers WHERE blacklisted < UNIX_TIMESTAMP() AND reserve=0 $ewhr");
foreach($r as $x) {
// encode the hostname in base58 and sanitize the IP to avoid any second order shell injections
$host=base58_encode($x['hostname']);