diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 047177d45..0e065dc3d 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -15,7 +15,6 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" - "github.com/davecgh/go-spew/spew" "github.com/lightninglabs/neutrino/cache" "github.com/lightninglabs/neutrino/cache/lru" "github.com/lightningnetwork/lnd/batch" @@ -1650,7 +1649,7 @@ func (d *AuthenticatedGossiper) handleNetworkMessages(ctx context.Context, if err != nil { // Something is wrong if SignalDependents returns an error. log.Errorf("SignalDependents returned error for msg=%v with "+ - "JobID=%v", spew.Sdump(nMsg.msg), jobID) + "JobID=%v", lnutils.SpewLogClosure(nMsg.msg), jobID) nMsg.err <- err @@ -3196,7 +3195,7 @@ func (d *AuthenticatedGossiper) handleChanUpdate(ctx context.Context, if err != nil { rErr := fmt.Errorf("unable to validate channel update "+ "announcement for short_chan_id=%v: %v", - spew.Sdump(upd.ShortChannelID), err) + lnutils.SpewLogClosure(upd.ShortChannelID), err) log.Error(rErr) nMsg.err <- rErr diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 0d85805b9..a3aae809b 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -13,7 +13,6 @@ import ( "github.com/btcsuite/btcd/btcec/v2/ecdsa" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/wire" - "github.com/davecgh/go-spew/spew" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/clock" @@ -1625,7 +1624,7 @@ out: } log.Debugf("Received outside contract resolution, "+ - "mapping to: %v", spew.Sdump(pkt)) + "mapping to: %v", lnutils.SpewLogClosure(pkt)) // We don't check the error, as the only failure we can // encounter is due to the circuit already being diff --git a/netann/channel_update.go b/netann/channel_update.go index d453b5306..c0adc81a2 100644 --- a/netann/channel_update.go +++ b/netann/channel_update.go @@ -8,9 +8,9 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/davecgh/go-spew/spew" "github.com/lightningnetwork/lnd/graph/db/models" "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lnutils" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/tlv" @@ -226,7 +226,7 @@ func verifyChannelUpdate1Signature(msg *lnwire.ChannelUpdate1, if !nodeSig.Verify(dataHash, pubKey) { return fmt.Errorf("invalid signature for channel update %v", - spew.Sdump(msg)) + lnutils.SpewLogClosure(msg)) } return nil @@ -249,7 +249,7 @@ func verifyChannelUpdate2Signature(c *lnwire.ChannelUpdate2, if !nodeSig.Verify(digest, pubKey) { return fmt.Errorf("invalid signature for channel update %v", - spew.Sdump(c)) + lnutils.SpewLogClosure(c)) } return nil @@ -279,13 +279,13 @@ func validateChannelUpdate1Fields(capacity btcutil.Amount, // The maxHTLC flag is mandatory. if !msg.MessageFlags.HasMaxHtlc() { return fmt.Errorf("max htlc flag not set for channel "+ - "update %v", spew.Sdump(msg)) + "update %v", lnutils.SpewLogClosure(msg)) } maxHtlc := msg.HtlcMaximumMsat if maxHtlc == 0 || maxHtlc < msg.HtlcMinimumMsat { return fmt.Errorf("invalid max htlc for channel "+ - "update %v", spew.Sdump(msg)) + "update %v", lnutils.SpewLogClosure(msg)) } // For light clients, the capacity will not be set so we'll skip @@ -308,7 +308,7 @@ func validateChannelUpdate2Fields(capacity btcutil.Amount, maxHtlc := c.HTLCMaximumMsat.Val if maxHtlc == 0 || maxHtlc < c.HTLCMinimumMsat.Val { return fmt.Errorf("invalid max htlc for channel update %v", - spew.Sdump(c)) + lnutils.SpewLogClosure(c)) } // Checking whether the MaxHTLC value respects the channel's capacity. diff --git a/peer/brontide.go b/peer/brontide.go index 5b0d84f2f..57e340fb0 100644 --- a/peer/brontide.go +++ b/peer/brontide.go @@ -19,7 +19,6 @@ import ( "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btclog/v2" - "github.com/davecgh/go-spew/spew" "github.com/lightningnetwork/lnd/buffer" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/channeldb" @@ -1230,7 +1229,7 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) ( } p.log.Tracef("Using link policy of: %v", - spew.Sdump(forwardingPolicy)) + lnutils.SpewLogClosure(forwardingPolicy)) // If the channel is pending, set the value to nil in the // activeChannels map. This is done to signify that the channel @@ -2839,7 +2838,7 @@ func (p *Brontide) queue(priority bool, msg lnwire.Message, case p.outgoingQueue <- outgoingMsg{priority, msg, errChan}: case <-p.cg.Done(): p.log.Tracef("Peer shutting down, could not enqueue msg: %v.", - spew.Sdump(msg)) + lnutils.SpewLogClosure(msg)) if errChan != nil { errChan <- lnpeer.ErrPeerExiting } diff --git a/routing/payment_lifecycle.go b/routing/payment_lifecycle.go index 7c9c0418a..8353cba15 100644 --- a/routing/payment_lifecycle.go +++ b/routing/payment_lifecycle.go @@ -7,7 +7,6 @@ import ( "time" "github.com/btcsuite/btcd/btcec/v2" - "github.com/davecgh/go-spew/spew" sphinx "github.com/lightningnetwork/lightning-onion" "github.com/lightningnetwork/lnd/fn/v2" "github.com/lightningnetwork/lnd/graph/db/models" @@ -301,7 +300,7 @@ lifecycle: continue lifecycle } - log.Tracef("Found route: %s", spew.Sdump(rt.Hops)) + log.Tracef("Found route: %s", lnutils.SpewLogClosure(rt.Hops)) // We found a route to try, create a new HTLC attempt to try. attempt, err := p.registerAttempt(rt, ps.RemainingAmt) @@ -767,7 +766,7 @@ func (p *paymentLifecycle) amendFirstHopData(rt *route.Route) error { log.Debugf("Aux traffic shaper returned custom "+ "records %v and amount %d msat for HTLC", - spew.Sdump(newRecords), newAmt) + lnutils.SpewLogClosure(newRecords), newAmt) return fn.Ok(extraDataRequest{ customRecords: fn.Some(newRecords), diff --git a/routing/router.go b/routing/router.go index 1dac1085d..3c35b7c52 100644 --- a/routing/router.go +++ b/routing/router.go @@ -13,7 +13,6 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" - "github.com/davecgh/go-spew/spew" "github.com/lightningnetwork/lnd/amp" "github.com/lightningnetwork/lnd/clock" "github.com/lightningnetwork/lnd/fn/v2" @@ -958,7 +957,8 @@ func spewPayment(payment *LightningPayment) lnutils.LogClosure { } p := *payment p.RouteHints = routeHints - return spew.Sdump(p) + + return lnutils.SpewLogClosure(p)() }) }