-
Notifications
You must be signed in to change notification settings - Fork 26
Require two channel updates #103
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
Require two channel updates #103
Conversation
|
I've assigned @TheBlueMatt as a reviewer! |
src/tracking.rs
Outdated
| if chain_hash == ChainHash::REGTEST { | ||
| // There must be two channel updates (one for each end) | ||
| // to generate a snapshot with information about the channel. | ||
| is_caught_up_with_gossip = new_message_count < 20 && previous_announcement_count > 0 && previous_update_count > 0 && counter.channel_updates > 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why are we being more strict on regtest than on mainnet? Presumably if its not ever getting to the finished state on regtest we should be removing conditions not adding ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that I start RGS, open a channel, RGS receives an announcement with one channel update, it sees that it caught up and generates snapshots, but they are empty because we need two channel updates for one channel to include channel information into snapshots. Empty snapshots are pretty much useless.
Here I want to wait for two channel updates, such that snapshots have information about the channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay, that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just do this globally, not only for regtest then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, on mainnet is normal to receive only one update for a channel (if it existed before and just one end got updated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're definitely not done syncing mainnet if the total number of channel updates we've seen is only one :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is counter.channel_updates only increasing? If yes, then I agree, it makes sense for any environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheBlueMatt just tell me what you think and I will implement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, counter.channel_updates should be strictly increasing forever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I removed the Regtest condition.
In order to generate a snapshot with information about a channel, it needs two channel updates (one for each end).
10439b8 to
90e6e4a
Compare
TheBlueMatt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
In order to generate a snapshot with information about a channel, it needs two channel updates (one for each end). The change is for Regtest because usually there are only few channels.