autopilot+funding+rpc+invoices: complete migration to lazy debug logging
In this commit, we complete the migration to lnutils.SpewLogClosure for the remaining application-layer components. This includes the autopilot channel management system, the funding manager, the RPC server, and the invoice storage subsystem.
This commit is contained in:
4 files changed
+17
-13
No files matched your search
+8
-5
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/lnutils"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
@@ -443,7 +443,7 @@ func (a *Agent) controller(ctx context.Context) {
|
||||
case *chanOpenUpdate:
|
||||
log.Debugf("New channel successfully opened, "+
|
||||
"updating state with: %v",
|
||||
spew.Sdump(update.newChan))
|
||||
lnutils.SpewLogClosure(update.newChan))
|
||||
|
||||
newChan := update.newChan
|
||||
a.chanStateMtx.Lock()
|
||||
@@ -460,7 +460,9 @@ func (a *Agent) controller(ctx context.Context) {
|
||||
case *chanCloseUpdate:
|
||||
log.Debugf("Applying closed channel "+
|
||||
"updates: %v",
|
||||
spew.Sdump(update.closedChans))
|
||||
lnutils.SpewLogClosure(
|
||||
update.closedChans),
|
||||
)
|
||||
|
||||
a.chanStateMtx.Lock()
|
||||
for _, closedChan := range update.closedChans {
|
||||
@@ -515,7 +517,8 @@ func (a *Agent) controller(ctx context.Context) {
|
||||
}
|
||||
|
||||
a.pendingMtx.Lock()
|
||||
log.Debugf("Pending channels: %v", spew.Sdump(a.pendingOpens))
|
||||
log.Debugf("Pending channels: %v",
|
||||
lnutils.SpewLogClosure(a.pendingOpens))
|
||||
a.pendingMtx.Unlock()
|
||||
|
||||
// With all the updates applied, we'll obtain a set of the
|
||||
@@ -699,7 +702,7 @@ func (a *Agent) openChans(ctx context.Context, availableFunds btcutil.Amount,
|
||||
}
|
||||
|
||||
log.Infof("Attempting to execute channel attachment "+
|
||||
"directives: %v", spew.Sdump(chanCandidates))
|
||||
"directives: %v", lnutils.SpewLogClosure(chanCandidates))
|
||||
|
||||
// Before proceeding, check to see if we have any slots
|
||||
// available to open channels. If there are any, we will attempt
|
||||
|
||||
+4
-3
@@ -18,7 +18,6 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/chanacceptor"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@@ -992,7 +991,9 @@ func (f *Manager) failFundingFlow(peer lnpeer.Peer, cid *chanIdentifier,
|
||||
}
|
||||
|
||||
log.Debugf("Sending funding error to peer (%x): %v",
|
||||
peer.IdentityKey().SerializeCompressed(), spew.Sdump(errMsg))
|
||||
peer.IdentityKey().SerializeCompressed(),
|
||||
lnutils.SpewLogClosure(errMsg))
|
||||
|
||||
if err := peer.SendMessage(false, errMsg); err != nil {
|
||||
log.Errorf("unable to send error message to peer %v", err)
|
||||
}
|
||||
@@ -1012,7 +1013,7 @@ func (f *Manager) sendWarning(peer lnpeer.Peer, cid *chanIdentifier,
|
||||
|
||||
log.Debugf("Sending funding warning to peer (%x): %v",
|
||||
peer.IdentityKey().SerializeCompressed(),
|
||||
spew.Sdump(errMsg),
|
||||
lnutils.SpewLogClosure(errMsg),
|
||||
)
|
||||
|
||||
if err := peer.SendMessage(false, errMsg); err != nil {
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
"github.com/lightningnetwork/lnd/graph/db/models"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnutils"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
"github.com/lightningnetwork/lnd/sqldb"
|
||||
@@ -409,7 +409,7 @@ func getInvoiceByRef(ctx context.Context,
|
||||
// In case the reference is ambiguous, meaning it matches more
|
||||
// than one invoice, we'll return an error.
|
||||
return sqlc.Invoice{}, fmt.Errorf("ambiguous invoice ref: "+
|
||||
"%s: %s", ref.String(), spew.Sdump(rows))
|
||||
"%s: %s", ref.String(), lnutils.SpewLogClosure(rows))
|
||||
|
||||
case err != nil:
|
||||
return sqlc.Invoice{}, fmt.Errorf("unable to fetch invoice: %w",
|
||||
|
||||
+3
-3
@@ -33,7 +33,6 @@ import (
|
||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/btcsuite/btcwallet/wallet/txauthor"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
proxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/lightningnetwork/lnd/autopilot"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
@@ -1526,7 +1525,8 @@ func (r *rpcServer) SendCoins(ctx context.Context,
|
||||
}
|
||||
|
||||
rpcsLog.Debugf("Sweeping coins from wallet to addr=%v, "+
|
||||
"with tx=%v", in.Addr, spew.Sdump(sweepTxPkg.SweepTx))
|
||||
"with tx=%v", in.Addr,
|
||||
lnutils.SpewLogClosure(sweepTxPkg.SweepTx))
|
||||
|
||||
// As our sweep transaction was created, successfully, we'll
|
||||
// now attempt to publish it, cancelling the sweep pkg to
|
||||
@@ -1612,7 +1612,7 @@ func (r *rpcServer) SendMany(ctx context.Context,
|
||||
}
|
||||
|
||||
rpcsLog.Infof("[sendmany] outputs=%v, sat/kw=%v",
|
||||
spew.Sdump(in.AddrToAmount), int64(feePerKw))
|
||||
lnutils.SpewLogClosure(in.AddrToAmount), int64(feePerKw))
|
||||
|
||||
var txid *chainhash.Hash
|
||||
|
||||
|
||||
Reference in new issue
Block a user