bugfix of balance from Daniel
@@ -223,6 +223,7 @@ static uint64_t unapply_block(struct block_internal *bi)
}
bi->flags &= ~BI_MAIN_REF;
+ bi->ref = 0;
for (i = 0; i < bi->nlinks; ++i) {
if (bi->link[i]->ref == bi && bi->link[i]->flags & BI_MAIN_REF) {
@@ -260,6 +261,7 @@ static void set_main(struct block_internal *m)
}
accept_amount(m, apply_block(m));
+ m->ref = m;
log_block((m->flags & BI_OURS ? "MAIN +" : "MAIN "), m->hash, m->time, m->storage_pos);
}
@@ -623,6 +625,7 @@ static int add_block_nolock(struct xdag_block *newBlock, xdag_time_t limit)
noref_last = blockRef0;
}
+ blockRef->ref = 0;
tmpNodeBlock.link[i]->flags |= BI_REF;
g_xdag_extstats.nnoref--;
}
