Documentation / @etherfold/core / hasReachedCursor
Function: hasReachedCursor() ​
hasReachedCursor(
cursor,target):boolean
Defined in: packages/core/src/generation/promotion.ts:144
THE TRIGGER: has this generation reached the cursor it is being measured against?
Cursors are lastToBlock, the block a fold has processed up to. A generation that has no cursor has processed nothing and has therefore reached nothing -- including the case where the target has no cursor either, since "neither has started" is not a demonstration.
The comparison is >= and against the LIVE cursor of the generation being measured against, not a snapshot taken when the successor was created. A snapshot would let a successor be promoted while the incumbent had moved on, which is precisely the state going backwards that story 14 exists to prevent; and the live comparison still converges, because a successor sharing the stream folds it within the same cycle the writer appends it. (The one place a SNAPSHOT is right is the deferred drop under immediate, where the question is "has the successor made up what the previous generation had AT THE PROMOTION", and the previous generation may have gone on advancing since.)
Parameters ​
cursor ​
number | undefined
target ​
number | undefined
Returns ​
boolean