ensure we only check for unaccounted blocks
This commit is contained in:
parent
3cf5049193
commit
365a91e407
@ -22,7 +22,7 @@ limitations under the License.
|
||||
require_once('shared.inc.php');
|
||||
|
||||
// Fetch our last block found from the DB as a starting point
|
||||
$aAllBlocks = $block->getAll('ASC');
|
||||
$aAllBlocks = $block->getAllUnaccounted('ASC');
|
||||
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||
if (!$aBlock['accounted']) {
|
||||
$iPrevBlockTime = @$aAllBlocks[$iIndex - 1]['time'];
|
||||
|
||||
@ -35,6 +35,17 @@ class Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAllUnaccounted($order='ASC') {
|
||||
$stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE accounted = 0 ORDER BY height $order");
|
||||
if ($this->checkStmt($stmt)) {
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$stmt->close();
|
||||
return $result->fetch_all(MYSQLI_ASSOC);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAll($order='DESC') {
|
||||
$stmt = $this->mysqli->prepare("SELECT * FROM $this->table ORDER BY height $order");
|
||||
if ($this->checkStmt($stmt)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user