backend: auto stop mining at pow end & fill mature_blocks

This commit is contained in:
Tanguy Pruvot 2016-11-24 01:13:35 +01:00
parent f31dd15d4e
commit 81518c4c7d
2 changed files with 12 additions and 0 deletions

View file

@ -44,6 +44,11 @@ function BackendBlockNew($coin, $db_block)
{
$earning->mature_time = time();
$earning->status = 1;
// auto update mature_blocks
if ($db_block->confirmations < $coin->mature_blocks || !intval($coin->mature_blocks)) {
$coin->mature_blocks = $db_block->confirmations;
$coin->save();
}
}
else // immature
$earning->status = 0;

View file

@ -232,6 +232,13 @@ function BackendCoinsUpdate()
$coin->version = $info['version'];
$coin->block_height = $info['blocks'];
if($coin->powend_height > 0 && $coin->block_height > $coin->powend_height) {
if ($coin->auto_ready) {
$coin->auto_ready = false;
$coin->errors = 'PoW end reached';
}
}
$coin->save();
// debuglog(" end $coin->name");