-
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
multi: clean up forwarding state from closed channels #4364
multi: clean up forwarding state from closed channels #4364
Conversation
fdd7f5d
to
ace52f9
Compare
ace52f9
to
cf74a41
Compare
2a4b09a
to
7d67b9f
Compare
7d67b9f
to
0c5fa37
Compare
2c9881e
to
a0ce45b
Compare
IIRC, this is because |
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.
This was buried at the bottom of some notifications, let's see if we can revive it!
One things I'm curious of about is how much state we can clean up for old very active nodes with this PR. To gather a ball park number, we could recruit some testers to run the migration in dry run mode, flagging that it won't commit anything to disk, so it should be safe.
htlcswitch/circuit_map.go
Outdated
} | ||
|
||
// Delete the keystone using the outgoing key. | ||
if err := keystoneBkt.Delete(k); err != nil { |
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.
Similar comment here re not deleting while iterating over a bucket.
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.
Fixed!
a9540a9
to
0b9f04a
Compare
Let me know when ready for another round @yyforyongyu |
This commit adds a method, Wipe, to remove all forwarding packages on disk for a given channel.
This commit adds a new field, NumForwardingPackages, in the PendingChannels RPC response to specify how many forwarding packages the channel has.
In this commit, a new method `cleanClosedChannels` is added and called when a circuit map is created. This method will delete the payment circuits and keystones for closed channels.
0b9f04a
to
198dc73
Compare
It's ready! PTAL. |
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 🥇
db := makeFwdPkgDB(t, "") | ||
|
||
shortChanID := lnwire.NewShortChanIDFromInt(1) | ||
packager := channeldb.NewChannelPackager(shortChanID) |
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 indeed, I agree it's not a normal unit test scenario, but in this case we're operating on a shared resource, meaning that accidental bug in the way we create the bucket keys may mean unexpected deletes. I'm ok with the test as is and this is more of an bonus we could add.
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 ⚒
This PR fixes #3052, which contains mainly two parts,
channeldb: clean forwarding packages for closed channels
The root bucket is “fwd-packages”, and further subdivided based on
ShortChanID
for each channel. When a channel is closed, itsShortChanID
is used to query the nested bucket in "fwd-packages", and the bucket is deleted. As suggested in htlcswitch: clean up forwarding state from closed channels #3052, theWipe
method inChannelContronller
is called inside the CloseChannel method.htlcswitch: clean circuits and keystones for closed channels
Fixes #4712