Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update-recency-based inclusion logic tests #65

Merged
merged 3 commits into from
Nov 11, 2023

Conversation

arik-so
Copy link
Contributor

@arik-so arik-so commented Nov 4, 2023

If the first channel update in a given direction was seen after (or at the exact second as) the last sync, the channel announcement and full updates in both directions should be included, even if one of the channels hasn't been updated since the last sync.

Conversely, if updates in both directions had been seen prior to the last sync, only the updates channel should be included, and only incrementally (unless all 5 properties changed).

When a channel has only recently become bidirectional,
but there has not been a new update in the old direction
since the last sync, the latest update in the old direction
must still be included in full because it is the first time
the full channel is being snapshotted.
@arik-so arik-so force-pushed the announcement-history-tests branch from 14bc952 to 52853c4 Compare November 4, 2023 06:06
{ // seed the db
let announcement = generate_announcement(short_channel_id);
let update_1 = generate_update(short_channel_id, false, timestamp, 0, 0, 0, 6, 0);
let update_2 = generate_update(short_channel_id, true, timestamp + 1, 0, 0, 0, 3, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests would be more readable if you left a one second gap between the "before last seen" and "after last seen" timestamps. As is the test assumes that anything with a timestamp equal to last query is included in a new update.

@TheBlueMatt TheBlueMatt merged commit f1a3c91 into lightningdevkit:main Nov 11, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants