-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
watchtower: handle rogue updates #7981
watchtower: handle rogue updates #7981
Conversation
The watchtower client test framework currently uses a mock version of the tower client DB. This can lead to bugs if the mock DB works slightly differently to the actual bbolt DB. So this commit ensures that we only use the bbolt db for the tower client tests. We also increment the `waitTime` used in the tests a bit to account for the slightly longer DB read and write times. Doing this switch resulted in one bug being caught: we were not removing sessions from the in-memory set on deletion of the session and so that is fixed here too.
Remove the use of the mock tower client DB and use the actual bbolt DB everywhere instead.
39e0097
to
76ee463
Compare
76ee463
to
c0014c2
Compare
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.
LGTM, super nice PR ✨
c0014c2
to
0d93a9b
Compare
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.
Very clean PR! Mostly questions🙏
This commit adds a new test to the tower client to demonstrate a bug that can happen if a channel is closed while an update for it has yet to be acked by the tower server. This will be fixed in an upcomming commit.
A pure refactor commit that passes the required buckets to the `getRangesWriteBucket` instead of re-fetching them.
In this commit, we introduce the concept of a rogue update. An update is rogue if we need to ACK it but we have already deleted all the data for the associated channel due to the channel being closed. In this case, we now no longer error out and instead keep count of how many rogue updates a session has backed-up.
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 @yyforyongyu !
0d93a9b
to
95c2bfe
Compare
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.
LGTM🏖
With this PR, we take introduce the concept of a "Rogue Update". A rogue update is an update of a channel that has already been closed. With this PR, if we go to Ack an update and discover that it is rogue, we will just keep count of the number of rogue updates that the session has backed-up.
In the first few commits, the testing infrastructure of the tower client is changed to only use the bbolt implementation instead of a mock implementation of the DB. This is so that the DB code can be tested properly.
Fixes #7980