From 36bb685cd73edb62157e0d5b4894694c3026e33e Mon Sep 17 00:00:00 2001 From: rkfg Date: Thu, 27 Jun 2024 15:53:18 +0300 Subject: [PATCH] Update fee after channel becomes active --- htlcswitch/link.go | 4 +++- htlcswitch/link_test.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index c0c828f834..6e31333493 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -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) l.wg.Add(1) go l.htlcManager() diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 93c76bd406..d0da3366ae 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -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) + n.bobChannelLink.updateFeeTimer.Reset(time.Minute * 10) // Fill up the commitment from Alice's side with 20 sat payments. count := (input.MaxHTLCNumber / 2)