mirror of
https://git.wownero.com/wownero/wownero-puddle.git
synced 2024-08-15 01:03:20 +00:00
fix orphaning
This commit is contained in:
parent
af3bf72f08
commit
af9b9c8953
1 changed files with 12 additions and 4 deletions
16
src/pool.c
16
src/pool.c
|
@ -743,7 +743,7 @@ process_blocks(block_t *blocks, size_t count)
|
||||||
}
|
}
|
||||||
block_t nb;
|
block_t nb;
|
||||||
memcpy(&nb, sb, sizeof(block_t));
|
memcpy(&nb, sb, sizeof(block_t));
|
||||||
if (ib->status & BLOCK_ORPHANED)
|
if (memcmp(ib->hash, sb->hash, 64) != 0)
|
||||||
{
|
{
|
||||||
log_debug("Orphaned block at height %"PRIu64, ib->height);
|
log_debug("Orphaned block at height %"PRIu64, ib->height);
|
||||||
nb.status |= BLOCK_ORPHANED;
|
nb.status |= BLOCK_ORPHANED;
|
||||||
|
@ -751,16 +751,24 @@ process_blocks(block_t *blocks, size_t count)
|
||||||
mdb_cursor_put(cursor, &key, &new_val, MDB_CURRENT);
|
mdb_cursor_put(cursor, &key, &new_val, MDB_CURRENT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (memcmp(ib->hash, sb->hash, 64) == 0
|
if (memcmp(ib->prev_hash, sb->prev_hash, 64) != 0)
|
||||||
&& memcmp(ib->prev_hash, sb->prev_hash, 64) != 0)
|
|
||||||
{
|
{
|
||||||
log_warn("Block with matching heights but differing parents! "
|
log_warn("Block with matching height and hash "
|
||||||
|
"but differing parent! "
|
||||||
"Setting orphaned.\n");
|
"Setting orphaned.\n");
|
||||||
nb.status |= BLOCK_ORPHANED;
|
nb.status |= BLOCK_ORPHANED;
|
||||||
MDB_val new_val = {sizeof(block_t), (void*)&nb};
|
MDB_val new_val = {sizeof(block_t), (void*)&nb};
|
||||||
mdb_cursor_put(cursor, &key, &new_val, MDB_CURRENT);
|
mdb_cursor_put(cursor, &key, &new_val, MDB_CURRENT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ib->status & BLOCK_ORPHANED)
|
||||||
|
{
|
||||||
|
log_debug("Orphaned block at height %"PRIu64, ib->height);
|
||||||
|
nb.status |= BLOCK_ORPHANED;
|
||||||
|
MDB_val new_val = {sizeof(block_t), (void*)&nb};
|
||||||
|
mdb_cursor_put(cursor, &key, &new_val, MDB_CURRENT);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
nb.status |= BLOCK_UNLOCKED;
|
nb.status |= BLOCK_UNLOCKED;
|
||||||
nb.reward = ib->reward;
|
nb.reward = ib->reward;
|
||||||
rc = payout_block(&nb, txn);
|
rc = payout_block(&nb, txn);
|
||||||
|
|
Loading…
Reference in a new issue