mirror of
https://git.wownero.com/wownero/wownero-puddle.git
synced 2024-08-15 01:03:20 +00:00
Some bug fixes moneromoo spotted
This commit is contained in:
parent
6fbe8860ed
commit
ce734bac92
1 changed files with 6 additions and 2 deletions
|
@ -289,7 +289,7 @@ compare_block(const MDB_val *a, const MDB_val *b)
|
||||||
{
|
{
|
||||||
const block_t *va = (const block_t*) a->mv_data;
|
const block_t *va = (const block_t*) a->mv_data;
|
||||||
const block_t *vb = (const block_t*) b->mv_data;
|
const block_t *vb = (const block_t*) b->mv_data;
|
||||||
int sc = strcmp(va->hash, vb->hash);
|
int sc = memcmp(va->hash, vb->hash, 64);
|
||||||
if (sc == 0)
|
if (sc == 0)
|
||||||
return (va->timestamp < vb->timestamp) ? -1 : va->timestamp > vb->timestamp;
|
return (va->timestamp < vb->timestamp) ? -1 : va->timestamp > vb->timestamp;
|
||||||
else
|
else
|
||||||
|
@ -458,6 +458,8 @@ miner_hr(const char *address)
|
||||||
if (strncmp(c->address, address, ADDRESS_MAX) == 0)
|
if (strncmp(c->address, address, ADDRESS_MAX) == 0)
|
||||||
{
|
{
|
||||||
double d = difftime(time(NULL), c->connected_since);
|
double d = difftime(time(NULL), c->connected_since);
|
||||||
|
if (d == 0.0)
|
||||||
|
break;
|
||||||
hr = c->hashes / d;
|
hr = c->hashes / d;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -469,6 +471,8 @@ miner_hr(const char *address)
|
||||||
uint64_t
|
uint64_t
|
||||||
miner_balance(const char *address)
|
miner_balance(const char *address)
|
||||||
{
|
{
|
||||||
|
if (strlen(address) > ADDRESS_MAX)
|
||||||
|
return 0;
|
||||||
int rc;
|
int rc;
|
||||||
char *err;
|
char *err;
|
||||||
MDB_txn *txn;
|
MDB_txn *txn;
|
||||||
|
@ -573,7 +577,7 @@ 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 (ib->hash == sb->hash && ib->prev_hash != sb->prev_hash)
|
if (memcmp(ib->hash, sb->hash, 64) == 0 && memcmp(ib->prev_hash, sb->prev_hash, 64) != 0)
|
||||||
{
|
{
|
||||||
log_warn("Have a block with matching heights but differing parents! Setting orphaned.\n");
|
log_warn("Have a block with matching heights but differing parents! Setting orphaned.\n");
|
||||||
block_t bp;
|
block_t bp;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue