mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-07 11:09:50 +00:00
cli: improve coin generated command for confirmed orphans
some unstable (or flooded) wallet chains like LUX may fork twice
This commit is contained in:
parent
f14ae825de
commit
3eb8c33fc3
1 changed files with 13 additions and 3 deletions
|
@ -296,9 +296,19 @@ class CoinCommand extends CConsoleCommand
|
||||||
$height = $cur_height - $tx['confirmations'] + 1;
|
$height = $cur_height - $tx['confirmations'] + 1;
|
||||||
if ($tx['confirmations'] < 3) continue; // let the backend detect them...
|
if ($tx['confirmations'] < 3) continue; // let the backend detect them...
|
||||||
$block = getdbosql('db_blocks', "coin_id={$coin->id} AND height=$height");
|
$block = getdbosql('db_blocks', "coin_id={$coin->id} AND height=$height");
|
||||||
if ($block)
|
if ($block) {
|
||||||
$nbOk++;
|
if ($block->category == 'orphan') {
|
||||||
else {
|
if ($start_height > 0 && $height >= $start_height) {
|
||||||
|
$block->category = 'new';
|
||||||
|
if ($block->save()) echo "Fixed orphan block id {$block->id}\n";
|
||||||
|
$nbOk++;
|
||||||
|
} else {
|
||||||
|
echo("warning: orphan block {$block->height} with confirmations!\n");
|
||||||
|
$nbMissed++;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
$nbOk++;
|
||||||
|
} else {
|
||||||
$time = round($tx['time'] / 900) * 900;
|
$time = round($tx['time'] / 900) * 900;
|
||||||
if ($time < time() - 2 * 24 * 3600) continue;
|
if ($time < time() - 2 * 24 * 3600) continue;
|
||||||
echo strftime("%Y-%m-%d %H:%M", $tx['time'])." $time missed block $height : ".json_encode($tx)."\n";
|
echo strftime("%Y-%m-%d %H:%M", $tx['time'])." $time missed block $height : ".json_encode($tx)."\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue