delete stuck transactions from mempool
This commit is contained in:
2
peer.php
2
peer.php
@@ -188,7 +188,7 @@ elseif($q=="submitBlock"){
|
|||||||
_log('['.$_SERVER['REMOTE_ADDR']."] block ok, repropagating - $data[height]");
|
_log('['.$_SERVER['REMOTE_ADDR']."] block ok, repropagating - $data[height]");
|
||||||
|
|
||||||
// send it to all our peers
|
// send it to all our peers
|
||||||
// system("php propagate.php block '$data[id]' all all linear > /dev/null 2>&1 &");
|
system("php propagate.php block '$data[id]' all all linear > /dev/null 2>&1 &");
|
||||||
api_echo("block-ok");
|
api_echo("block-ok");
|
||||||
}
|
}
|
||||||
// return the current block, used in syncing
|
// return the current block, used in syncing
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ if((empty($peer)||$peer=='all')&&$type=="block"){
|
|||||||
$res=file_put_contents("tmp/$id",$data);
|
$res=file_put_contents("tmp/$id",$data);
|
||||||
if($res===false) die("Could not write the cache file");
|
if($res===false) die("Could not write the cache file");
|
||||||
// broadcasting to all peers
|
// 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) {
|
foreach($r as $x) {
|
||||||
// encode the hostname in base58 and sanitize the IP to avoid any second order shell injections
|
// encode the hostname in base58 and sanitize the IP to avoid any second order shell injections
|
||||||
$host=base58_encode($x['hostname']);
|
$host=base58_encode($x['hostname']);
|
||||||
|
|||||||
@@ -396,6 +396,9 @@ if($current['height']<$largest_height&&$largest_height>1){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// deleting mempool transactions older than 14 days
|
||||||
|
$db->run("DELETE FROM `mempool` WHERE `date` < UNIX_TIMESTAMP()-(3600*24*14)");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//rebroadcasting local transactions
|
//rebroadcasting local transactions
|
||||||
|
|||||||
Reference in New Issue
Block a user