resync if stale

This commit is contained in:
admin@arionum.com
2019-12-26 14:52:12 +02:00
parent 8a9715f306
commit 16d205ff06
3 changed files with 72 additions and 64 deletions

14
api.php
View File

@@ -664,12 +664,18 @@ if ($q == "getAddress") {
* @apiGroup API
* @apiDescription Returns all the masternode data
*
* @apiParam {string} [public_key] Optional public key
*
*
* @apiSuccess {boolean} data masternode date
* @apiSuccess {json} data masternode date
*/
$res=$db->run("SELECT * FROM masternode ORDER by public_key ASC");
$bind=[];
$whr='';
$public_key=san($data['public_key']);
if(!empty($public_key)){
$whr="WHERE public_key=:public_key";
$bind[':public_key']=$public_key;
}
$res=$db->run("SELECT * FROM masternode $whr ORDER by public_key ASC",$bind);
api_echo(["masternodes"=>$res, "hash"=>md5(json_encode($res))]);
} elseif ($q == "getAlias") {