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

lightningnetwork / lnd / 12986279612

27 Jan 2025 09:51AM UTC coverage: 57.652% (-1.1%) from 58.788%
12986279612

Pull #9447

github

yyforyongyu
sweep: rename methods for clarity

We now rename "third party" to "unknown" as the inputs can be spent via
an older sweeping tx, a third party (anchor), or a remote party (pin).
In fee bumper we don't have the info to distinguish the above cases, and
leave them to be further handled by the sweeper as it has more context.
Pull Request #9447: sweep: start tracking input spending status in the fee bumper

83 of 87 new or added lines in 2 files covered. (95.4%)

19578 existing lines in 256 files now uncovered.

103448 of 179434 relevant lines covered (57.65%)

24884.58 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