-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Update fee after channel becomes active #8876
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -533,7 +533,9 @@ func (l *channelLink) Start() error { | |||||||||||||
| }() | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| l.updateFeeTimer = time.NewTimer(l.randomFeeUpdateTimeout()) | ||||||||||||||
| // this timer will fire in one minute after the channel is ready | ||||||||||||||
| // and it will reset to a random interval after that | ||||||||||||||
| l.updateFeeTimer = time.NewTimer(time.Minute) | ||||||||||||||
|
Comment on lines
+536
to
+538
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR description states the goal is to trigger the fee update 'right after the channel becomes active', but a one-minute delay is used here. While this is an improvement over the previous 10-60 minute random delay, a shorter duration like 10 seconds would better match the stated intent. Additionally, the comment explains what the code does, but not why. According to the style guide, comments should explain the 'why' behind the code. I've suggested an improved comment that clarifies the intent.
Suggested change
References
|
||||||||||||||
|
|
||||||||||||||
| l.wg.Add(1) | ||||||||||||||
| go l.htlcManager() | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -856,6 +856,10 @@ func TestChannelLinkCancelFullCommitment(t *testing.T) { | |||||||||||||||||
| n := newTwoHopNetwork( | ||||||||||||||||||
| t, channels.aliceToBob, channels.bobToAlice, testStartingHeight, | ||||||||||||||||||
| ) | ||||||||||||||||||
| // This test takes a long time to finish and the link breaks if the fee | ||||||||||||||||||
| // update times out during it, blocking the test indefinitely | ||||||||||||||||||
| n.aliceChannelLink.updateFeeTimer.Reset(time.Minute * 10) | ||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This mitigation works, though it may introduce flakiness to the unit tests since we are now relying on them to be finished in under 1min. We should still give the "send out a fee update immediately on startup" a shot, and I'll help figure out how to best handle the tests.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many tests break if we immediately send an update. If you're up to the task then sure, this change is trivial enough. But I still think it's better to set the timer to 0 instead (achieving the same effect without forcing it in all cases), reset it to 10 minutes for the tests + write a separate test for this instant update. I'll take a look in a day or two!
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yyforyongyu Hi, maybe you could take this over? I really don't have time now it seems...
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, thanks for all the input so far! |
||||||||||||||||||
| n.bobChannelLink.updateFeeTimer.Reset(time.Minute * 10) | ||||||||||||||||||
|
Comment on lines
+859
to
+862
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of resetting the timer to a longer duration (10 minutes), it would be cleaner and make the test more deterministic to stop the timer altogether. This prevents any fee updates from occurring during this long-running test, avoiding potential interference with the test's logic. Note that if !timer.Stop() {
select {
case <-timer.C:
default:
}
}
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| // Fill up the commitment from Alice's side with 20 sat payments. | ||||||||||||||||||
| count := (input.MaxHTLCNumber / 2) | ||||||||||||||||||
|
|
||||||||||||||||||
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.
Linking back to the issue,
Though less likely, if the following happened we'd still have this issue or?