From 94a1a07e8ce4057fac5c38aca2ed8e61e62e592b Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 2 Jan 2025 13:33:33 +0000 Subject: [PATCH 1/6] tapchannel: use trace log level for unhandled channel update messages Change the log level from debug to trace for unhandled channel update messages. This reduces noise in the debug logs while still allowing visibility when needed. --- tapchannel/aux_funding_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tapchannel/aux_funding_controller.go b/tapchannel/aux_funding_controller.go index 3a298501d..1fb6ab544 100644 --- a/tapchannel/aux_funding_controller.go +++ b/tapchannel/aux_funding_controller.go @@ -2136,8 +2136,8 @@ func (f *FundingController) CanHandle(msg msgmux.PeerMsg) bool { return true } - log.Debugf("Failed to handle: %T", msg.Message) - + log.Tracef("FundingController encountered an unsupported message "+ + "type: %T", msg.Message) return false } From a949174f4e7527f73351c4212f47f4be069e9b49 Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 2 Jan 2025 13:53:24 +0000 Subject: [PATCH 2/6] server: improve ShouldHandleTraffic logging Improve logging for HandleTraffic method to include fundingBlob in hexadecimal format --- server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index dcd16e32e..76951a2b2 100644 --- a/server.go +++ b/server.go @@ -997,8 +997,8 @@ func (s *Server) ChannelFinalized(pid funding.PendingChanID) error { func (s *Server) ShouldHandleTraffic(cid lnwire.ShortChannelID, fundingBlob lfn.Option[tlv.Blob]) (bool, error) { - srvrLog.Debugf("HandleTraffic called, cid=%v, fundingBlob=%v", cid, - spew.Sdump(fundingBlob)) + srvrLog.Debugf("HandleTraffic called (cid=%v, fundingBlob=%x)", cid, + fundingBlob.UnwrapOr(tlv.Blob{})) if err := s.waitForReady(); err != nil { return false, err From 4bda4eaf156a3f94e018cc23781581a1359010c6 Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 2 Jan 2025 14:01:26 +0000 Subject: [PATCH 3/6] universe: syncServerState logs server address in string format Updated the syncServerState method to log the server address in string format. This change simplifies log entries, improving clarity and reducing clutter in log files. --- universe/auto_syncer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/universe/auto_syncer.go b/universe/auto_syncer.go index cb39111bf..6ef10ac6f 100644 --- a/universe/auto_syncer.go +++ b/universe/auto_syncer.go @@ -199,7 +199,7 @@ func (f *FederationEnvoy) Stop() error { func (f *FederationEnvoy) syncServerState(ctx context.Context, addr ServerAddr, syncConfigs SyncConfigs) error { - log.Infof("Syncing Universe state with server=%v", spew.Sdump(addr)) + log.Infof("Syncing Universe state with server=%s", addr.HostStr()) // Attempt to sync with the remote Universe server, if this errors then // we'll bail out early as something wrong happened. From e1d9b1a8f0babc2e6535f6778a43b9dafbba0849 Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 2 Jan 2025 14:15:23 +0000 Subject: [PATCH 4/6] rfq: fix log message term from "ask" to "bid" Corrected the log message to use "bid" instead of "ask" as the original term was incorrect. --- rfq/negotiator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfq/negotiator.go b/rfq/negotiator.go index 2dcb97542..4774eeaaa 100644 --- a/rfq/negotiator.go +++ b/rfq/negotiator.go @@ -439,7 +439,7 @@ func (n *Negotiator) HandleIncomingSellRequest( sendOutgoingMsg(msg) // Add an error to the error channel and return. - err = fmt.Errorf("failed to query ask price from "+ + err = fmt.Errorf("failed to query bid price from "+ "oracle: %w", err) n.cfg.ErrChan <- err return From 8a5bfad6cf4e252de60dd6a6dba9d3e1feb38789 Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 2 Jan 2025 15:27:46 +0000 Subject: [PATCH 5/6] fn: add `Option.String` method Introduce the `String` method for `Option` to improve logging capabilities. --- fn/option.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fn/option.go b/fn/option.go index 125183d3f..56780e4bc 100644 --- a/fn/option.go +++ b/fn/option.go @@ -1,12 +1,23 @@ package fn -// Option[A] represents a value which may or may not be there. This is very +import "fmt" + +// Option represents a value which may or may not be there. This is very // often preferable to nil-able pointers. type Option[A any] struct { isSome bool some A } +// String returns a string representation of the Option. +func (o Option[A]) String() string { + if o.isSome { + return fmt.Sprintf("Some(%v)", o.some) + } + + return "None" +} + // Some trivially injects a value into an optional context. // // Some : A -> Option[A]. From ee22f42d8ce44c5377a2bdf14fa17c985b5e37af Mon Sep 17 00:00:00 2001 From: ffranr Date: Thu, 2 Jan 2025 15:31:22 +0000 Subject: [PATCH 6/6] rfq: add log message for QueryAskPrice endpoint usage Log a message when querying the price oracle service via the `QueryAskPrice` endpoint to improve traceability and debugging. --- rfq/negotiator.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rfq/negotiator.go b/rfq/negotiator.go index 4774eeaaa..7b77e1fc9 100644 --- a/rfq/negotiator.go +++ b/rfq/negotiator.go @@ -119,6 +119,11 @@ func (n *Negotiator) queryBidFromPriceOracle(assetSpecifier asset.Specifier, ctx, cancel := n.WithCtxQuitNoTimeout() defer cancel() + log.Debugf("Querying price oracle for bid price (asset_specifier=%s, "+ + "asset_max_amt=%s, payment_max_amt=%s, asset_rate_hint=%s)", + assetSpecifier.String(), assetMaxAmt.String(), + paymentMaxAmt.String(), assetRateHint.String()) + oracleResponse, err := n.cfg.PriceOracle.QueryBidPrice( ctx, assetSpecifier, assetMaxAmt, paymentMaxAmt, assetRateHint, ) @@ -240,6 +245,11 @@ func (n *Negotiator) queryAskFromPriceOracle(assetSpecifier asset.Specifier, ctx, cancel := n.WithCtxQuitNoTimeout() defer cancel() + log.Debugf("Querying price oracle for ask price (asset_specifier=%s, "+ + "asset_max_amt=%s, payment_max_amt=%s, asset_rate_hint=%s)", + assetSpecifier.String(), assetMaxAmt.String(), + paymentMaxAmt.String(), assetRateHint.String()) + oracleResponse, err := n.cfg.PriceOracle.QueryAskPrice( ctx, assetSpecifier, assetMaxAmt, paymentMaxAmt, assetRateHint,