From a307280c40e7e596b06af1f92908109744ac4192 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 26 Mar 2025 16:23:04 -0700 Subject: [PATCH 1/2] protofsm: reduce log spam during state transitions In this commit, we reduce log spam a bit during state transitions. We only log the type of the event when sending the event, as we'll print the same event when creating the queue "applying", and later when processing". Next we remove the "applying" log as that first event will always be logged twice. The combo of these to changes makes the logs much easier to follow. --- protofsm/state_machine.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/protofsm/state_machine.go b/protofsm/state_machine.go index c759d061a..3930fdff2 100644 --- a/protofsm/state_machine.go +++ b/protofsm/state_machine.go @@ -237,8 +237,7 @@ func (s *StateMachine[Event, Env]) Stop() { // // TODO(roasbeef): bool if processed? func (s *StateMachine[Event, Env]) SendEvent(ctx context.Context, event Event) { - s.log.DebugS(ctx, "Sending event", - "event", lnutils.SpewLogClosure(event)) + s.log.Debugf("Sending event %T", event) select { case s.events <- event: @@ -544,9 +543,6 @@ func (s *StateMachine[Event, Env]) applyEvents(ctx context.Context, currentState State[Event, Env], newEvent Event) (State[Event, Env], error) { - s.log.DebugS(ctx, "Applying new event", - "event", lnutils.SpewLogClosure(newEvent)) - eventQueue := fn.NewQueue(newEvent) // Given the next event to handle, we'll process the event, then add From f08e7fe0d6c123d42ea6b66609daf0c2b2640cc3 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 26 Mar 2025 16:35:30 -0700 Subject: [PATCH 2/2] lnwallet/chancloser: fix flake in TestRbfChannelFlushingTransitions/early_offer In this commit, we fix a flake in the `TestRbfChannelFlushingTransitions/early_offer` test. The fix is simple: this is actually an "iteration", as we have a self transition to the ChannelNegotiation state first. We also don't need to send the remoteOffer, so we set `sendInit` to false. The offer still needs to be passed in to ensure that the assertions work however. --- lnwallet/chancloser/rbf_coop_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnwallet/chancloser/rbf_coop_test.go b/lnwallet/chancloser/rbf_coop_test.go index 33da8b2c3..ab2526e77 100644 --- a/lnwallet/chancloser/rbf_coop_test.go +++ b/lnwallet/chancloser/rbf_coop_test.go @@ -1353,8 +1353,8 @@ func TestRbfChannelFlushingTransitions(t *testing.T) { // offer and send our sig). closeHarness.chanCloser.SendEvent(ctx, &flushEvent) closeHarness.assertSingleRemoteRbfIteration( - remoteOffer, absoluteFee, absoluteFee, sequence, false, - true, + remoteOffer, absoluteFee, absoluteFee, sequence, true, + false, ) })