Skip to content

Commit

Permalink
temp: debug commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aakselrod committed Dec 6, 2024
1 parent a77c741 commit 3366773
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
20 changes: 20 additions & 0 deletions chainntnfs/txnotifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,9 @@ func (n *TxNotifier) dispatchConfDetails(
case ntfn.Event.Confirmed <- details:
ntfn.dispatched = true
case <-n.quit:
Log.Debugf("TxNotifier exiting when notifying for %v "+
"confs, conf_id=%v, %v", ntfn.NumConfirmations,
ntfn.ConfID, ntfn.ConfRequest)
return ErrTxNotifierExiting
}
} else {
Expand Down Expand Up @@ -1784,6 +1787,9 @@ func (n *TxNotifier) NotifyHeight(height uint32) error {
case ntfn.Event.Confirmed <- &confDetails:
ntfn.dispatched = true
case <-n.quit:
Log.Debugf("TxNotifier exiting when notifying for %v "+
"confs, conf_id=%v, %v", ntfn.NumConfirmations,
ntfn.ConfID, ntfn.ConfRequest)
return ErrTxNotifierExiting
}
}
Expand Down Expand Up @@ -1854,6 +1860,9 @@ func (n *TxNotifier) DisconnectTip(blockHeight uint32) error {
select {
case <-ntfn.Event.Updates:
case <-n.quit:
Log.Debugf("TxNotifier exiting when notifying for %v "+

Check failure on line 1863 in chainntnfs/txnotifier.go

View workflow job for this annotation

GitHub Actions / lint code

the line is 95 characters long, which exceeds the maximum of 80 characters. (ll)
"confs, conf_id=%v, %v", ntfn.NumConfirmations,

Check failure on line 1864 in chainntnfs/txnotifier.go

View workflow job for this annotation

GitHub Actions / lint code

the line is 95 characters long, which exceeds the maximum of 80 characters. (ll)
ntfn.ConfID, ntfn.ConfRequest)
return ErrTxNotifierExiting
default:
}
Expand Down Expand Up @@ -2023,6 +2032,9 @@ func (n *TxNotifier) dispatchConfReorg(ntfn *ConfNtfn,
select {
case <-ntfn.Event.Confirmed:
case <-n.quit:
Log.Debugf("TxNotifier exiting when notifying for %v "+
"confs, conf_id=%v, %v", ntfn.NumConfirmations,
ntfn.ConfID, ntfn.ConfRequest)
return ErrTxNotifierExiting
default:
}
Expand All @@ -2034,6 +2046,9 @@ func (n *TxNotifier) dispatchConfReorg(ntfn *ConfNtfn,
select {
case ntfn.Event.NegativeConf <- int32(n.reorgDepth):
case <-n.quit:
Log.Debugf("TxNotifier exiting when notifying for %v "+
"confs, conf_id=%v, %v", ntfn.NumConfirmations,
ntfn.ConfID, ntfn.ConfRequest)
return ErrTxNotifierExiting
}

Expand Down Expand Up @@ -2061,6 +2076,8 @@ func (n *TxNotifier) dispatchSpendReorg(ntfn *SpendNtfn) error {
select {
case ntfn.Event.Reorg <- struct{}{}:
case <-n.quit:
Log.Debugf("TxNotifier exiting when notifying for conf_id=%v, %v",

Check failure on line 2079 in chainntnfs/txnotifier.go

View workflow job for this annotation

GitHub Actions / lint code

the line is 82 characters long, which exceeds the maximum of 80 characters. (ll)
ntfn.SpendID, ntfn.SpendRequest)
return ErrTxNotifierExiting
}

Expand Down Expand Up @@ -2119,6 +2136,9 @@ func (n *TxNotifier) notifyNumConfsLeft(ntfn *ConfNtfn, num uint32) error {
select {
case ntfn.Event.Updates <- num:
case <-n.quit:
Log.Debugf("TxNotifier exiting when notifying for %v "+
"confs, conf_id=%v, %v", ntfn.NumConfirmations,
ntfn.ConfID, ntfn.ConfRequest)
return ErrTxNotifierExiting

Check failure on line 2142 in chainntnfs/txnotifier.go

View workflow job for this annotation

GitHub Actions / lint code

return with no blank line before (nlreturn)
}

Expand Down
13 changes: 13 additions & 0 deletions funding/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/binary"
"fmt"
"io"
"runtime"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -783,12 +784,24 @@ func (f *Manager) Stop() error {
defer log.Debug("Funding manager shutdown complete")

close(f.quit)
log.Infof("%s", stack())
f.wg.Wait()
})

return nil
}

func stack() []byte {
buf := make([]byte, 1024)
for {
n := runtime.Stack(buf, true)
if n < len(buf) {
return buf[:n]
}
buf = make([]byte, 2*len(buf))
}
}

// rebroadcastFundingTx publishes the funding tx on startup for each
// unconfirmed channel.
func (f *Manager) rebroadcastFundingTx(c *channeldb.OpenChannel) {
Expand Down
5 changes: 3 additions & 2 deletions kvdb/sqlbase/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"runtime/debug"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -238,8 +239,8 @@ func (db *db) executeTransaction(f func(tx walletdb.ReadWriteTx) error,
}

onBackoff := func(retry int, delay time.Duration) {
log.Tracef("Retrying transaction due to tx serialization "+
"error, attempt_number=%v, delay=%v", retry, delay)
log.Debugf("Retrying transaction due to tx serialization "+
"error, attempt_number=%v, delay=%v: %s", retry, delay, debug.Stack())
}

rollbackTx := func(tx sqldb.Tx) error {
Expand Down
5 changes: 5 additions & 0 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/btcsuite/btcd/rpcclient"
btclogv1 "github.com/btcsuite/btclog"
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btcwallet/waddrmgr"
"github.com/lightninglabs/neutrino"
sphinx "github.com/lightningnetwork/lightning-onion"
"github.com/lightningnetwork/lnd/autopilot"
Expand All @@ -26,6 +27,7 @@ import (
"github.com/lightningnetwork/lnd/healthcheck"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/invoices"
"github.com/lightningnetwork/lnd/kvdb/sqlbase"
"github.com/lightningnetwork/lnd/lncfg"
"github.com/lightningnetwork/lnd/lnrpc/autopilotrpc"
"github.com/lightningnetwork/lnd/lnrpc/chainrpc"
Expand Down Expand Up @@ -177,6 +179,9 @@ func SetupLoggers(root *build.SubLoggerManager, interceptor signal.Interceptor)
AddSubLogger(root, "CHCL", interceptor, chancloser.UseLogger)
AddSubLogger(root, "LCHN", interceptor, localchans.UseLogger)

AddV1SubLogger(root, "WMGR", interceptor, waddrmgr.UseLogger)
AddSubLogger(root, "SQLB", interceptor, sqlbase.UseLogger)

AddSubLogger(root, routing.Subsystem, interceptor, routing.UseLogger)
AddSubLogger(root, routerrpc.Subsystem, interceptor, routerrpc.UseLogger)
AddSubLogger(root, chanfitness.Subsystem, interceptor, chanfitness.UseLogger)
Expand Down

0 comments on commit 3366773

Please sign in to comment.