Merge pull request #1890 from mxaddict/master
Pull request for findblock cron fix, related to orphaned blocks.
This commit is contained in:
commit
5fc516f6b9
@ -26,7 +26,7 @@ chdir(dirname(__FILE__));
|
||||
require_once('shared.inc.php');
|
||||
|
||||
// Fetch our last block found from the DB as a starting point
|
||||
$aLastBlock = @$block->getLast();
|
||||
$aLastBlock = @$block->getLastValid();
|
||||
$strLastBlockHash = $aLastBlock['blockhash'];
|
||||
if (!$strLastBlockHash) $strLastBlockHash = '';
|
||||
|
||||
|
||||
@ -15,6 +15,18 @@ class Block extends Base {
|
||||
return $result->fetch_assoc();
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific method to fetch the latest block found that is VALID
|
||||
* @param none
|
||||
* @return data array Array with database fields as keys
|
||||
**/
|
||||
public function getLastValid() {
|
||||
$stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE confirmations > -1 ORDER BY height DESC LIMIT 1");
|
||||
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_assoc();
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific block, by block height
|
||||
|
||||
Loading…
Reference in New Issue
Block a user