orphanBlockCount property
int
get
orphanBlockCount
Blocks whose parent element is not present in this state — either deltas delivered ahead of their parent (transient, heals on merge) or children of pruned blocks (permanent; indicates a violated prune barrier). Non-empty AFTER a full sync = investigate.
Counts every non-origin block whose parent Dot a _locate fails to
resolve. O(N) over blocks and allocation-free (the _locate lookup is
inlined so no record is materialised per block); not cached.
Implementation
int get orphanBlockCount {
var n = 0;
for (final b in _blocks.values) {
final p = b.parent;
if (p.isOrigin) continue;
final tree = _byReplica[p.replica];
if (tree == null) {
n++;
continue;
}
final key = tree.lastKeyBefore(p.counter + 1);
if (key == null) {
n++;
continue;
}
final pb = tree[key]!;
final off = p.counter - pb.start.counter;
if (off < 0 || off >= pb.length) n++;
}
return n;
}