• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13536249039

26 Feb 2025 03:42AM UTC coverage: 57.462% (-1.4%) from 58.835%
13536249039

Pull #8453

github

Roasbeef
peer: update chooseDeliveryScript to gen script if needed

In this commit, we update `chooseDeliveryScript` to generate a new
script if needed. This allows us to fold in a few other lines that
always followed this function into this expanded function.

The tests have been updated accordingly.
Pull Request #8453: [4/4] - multi: integrate new rbf coop close FSM into the existing peer flow

275 of 1318 new or added lines in 22 files covered. (20.86%)

19521 existing lines in 257 files now uncovered.

103858 of 180741 relevant lines covered (57.46%)

24750.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/build/log_shutdown.go
1
package build
2

3
import (
4
        "context"
5

6
        "github.com/btcsuite/btclog/v2"
7
)
8

9
// ShutdownLogger wraps an existing logger with a shutdown function which will
10
// be called on Critical/Criticalf to prompt shutdown.
11
type ShutdownLogger struct {
12
        btclog.Logger
13
        shutdown func()
14
}
15

16
// NewShutdownLogger creates a shutdown logger for the log provided which will
17
// use the signal package to request shutdown on critical errors.
UNCOV
18
func NewShutdownLogger(logger btclog.Logger, shutdown func()) *ShutdownLogger {
×
UNCOV
19
        return &ShutdownLogger{
×
UNCOV
20
                Logger:   logger,
×
UNCOV
21
                shutdown: shutdown,
×
UNCOV
22
        }
×
UNCOV
23
}
×
24

25
// Criticalf formats message according to format specifier and writes to
26
// log with LevelCritical. It will then call the shutdown logger's shutdown
27
// function to prompt safe shutdown.
28
//
29
// Note: it is part of the btclog.Logger interface.
30
func (s *ShutdownLogger) Criticalf(format string, params ...interface{}) {
×
31
        s.Logger.Criticalf(format, params...)
×
32
        s.Logger.Info("Sending request for shutdown")
×
33
        s.shutdown()
×
34
}
×
35

36
// Critical formats message using the default formats for its operands
37
// and writes to log with LevelCritical. It will then call the shutdown
38
// logger's shutdown function to prompt safe shutdown.
39
//
40
// Note: it is part of the btclog.Logger interface.
41
func (s *ShutdownLogger) Critical(v ...interface{}) {
×
42
        s.Logger.Critical(v)
×
43
        s.Logger.Info("Sending request for shutdown")
×
44
        s.shutdown()
×
45
}
×
46

47
// CriticalS writes a structured log with the given message and key-value pair
48
// attributes with LevelCritical to the log. It will then call the shutdown
49
// logger's shutdown function to prompt safe shutdown.
50
//
51
// Note: it is part of the btclog.Logger interface.
52
func (s *ShutdownLogger) CriticalS(ctx context.Context, msg string, err error,
53
        attr ...interface{}) {
×
54

×
55
        s.Logger.CriticalS(ctx, msg, err, attr...)
×
56
        s.Logger.Info("Sending request for shutdown")
×
57
        s.shutdown()
×
58
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc