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 fee after channel becomes active #8876

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion htlcswitch/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

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,

Open the app, do any payments, close it in under 10 minutes

Though less likely, if the following happened we'd still have this issue or?

Open the app, do any payments, close it in under 1 minutes


l.wg.Add(1)
go l.htlcManager()
Expand Down
4 changes: 4 additions & 0 deletions htlcswitch/link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The 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!

Copy link
Author

Choose a reason for hiding this comment

The 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...

Copy link
Member

Choose a reason for hiding this comment

The 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)

// Fill up the commitment from Alice's side with 20 sat payments.
count := (input.MaxHTLCNumber / 2)
Expand Down
Loading