Skip to content

Commit 64febcb

Browse files
build: update to testnet4 compatible lndclient dependency
1 parent ff127d2 commit 64febcb

File tree

9 files changed

+525
-833
lines changed

9 files changed

+525
-833
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
# go needs absolute directories, using the $HOME variable doesn't work here.
1717
GOCACHE: /home/runner/work/go/pkg/build
1818
GOPATH: /home/runner/work/go
19-
GO_VERSION: 1.21.6
19+
GO_VERSION: 1.23.6
2020

2121
jobs:
2222
########################

.golangci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
run:
22
# timeout for analysis
3-
deadline: 10m
3+
timeout: 10m
4+
5+
go: "1.23"
46

57
linters-settings:
68
govet:
@@ -20,13 +22,11 @@ linters:
2022
- asciicheck
2123
- bidichk
2224
- bodyclose
23-
- deadcode
2425
- decorder
2526
- dupl
2627
- durationcheck
2728
- errcheck
2829
- errchkjson
29-
- execinquery
3030
- exportloopref
3131
- gocritic
3232
- godot
@@ -51,12 +51,10 @@ linters:
5151
- rowserrcheck
5252
- sqlclosecheck
5353
- staticcheck
54-
- structcheck
5554
- tagliatelle
5655
- tenv
5756
- typecheck
5857
- unconvert
5958
- unparam
6059
- unused
61-
- varcheck
6260
- wastedassign

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# /Dockerfile
33
# /tools/Dockerfile
44
# /.github/workflows/main.yml
5-
FROM golang:1.21.6-alpine as builder
5+
FROM golang:1.23.6-alpine as builder
66

77
# Install build dependencies such as git and glide.
88
RUN apk add --no-cache git gcc musl-dev

collectors/log.go

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,60 @@ package collectors
22

33
import (
44
"fmt"
5-
"io"
65
"os"
76
"path/filepath"
87

9-
"github.com/btcsuite/btclog"
10-
"github.com/jrick/logrotate/rotator"
8+
"github.com/btcsuite/btclog/v2"
119
"github.com/lightningnetwork/lnd/build"
1210
)
1311

1412
var (
15-
logWriter = &build.LogWriter{}
16-
backendLog = btclog.NewBackend(logWriter)
17-
1813
// Logger for lndmon's main process.
19-
Logger = backendLog.Logger("LNDMON")
14+
Logger btclog.Logger
2015

2116
// htlcLogger is a logger for lndmon's htlc collector.
22-
htlcLogger = build.NewSubLogger("HTLC", backendLog.Logger)
17+
htlcLogger btclog.Logger
2318

2419
// paymentLogger is a logger for lndmon's payments monitor.
25-
paymentLogger = build.NewSubLogger("PMNT", backendLog.Logger)
20+
paymentLogger btclog.Logger
21+
22+
noOpShutdownFunc = func() {}
2623
)
2724

2825
// initLogRotator initializes the logging rotator to write logs to logFile and
2926
// create roll files in the same directory. It must be called before the
3027
// package-global log rotator variables are used.
31-
func initLogRotator(logFile string, maxLogFileSize int, maxLogFiles int) error {
28+
func initLogRotator(logFile string, maxLogFileSize, maxLogFiles int) error {
3229
logDir, _ := filepath.Split(logFile)
33-
err := os.MkdirAll(logDir, 0700)
34-
if err != nil {
30+
if err := os.MkdirAll(logDir, 0700); err != nil {
3531
return fmt.Errorf("failed to create log directory: %v", err)
3632
}
3733

38-
r, err := rotator.New(
39-
logFile, int64(maxLogFileSize*1024), false, maxLogFiles,
40-
)
41-
if err != nil {
42-
return fmt.Errorf("failed to create file rotator: %v", err)
34+
// Setup the rotating log writer.
35+
logRotator := build.NewRotatingLogWriter()
36+
logCfg := build.DefaultLogConfig()
37+
logCfg.File.MaxLogFileSize = maxLogFileSize
38+
logCfg.File.MaxLogFiles = maxLogFiles
39+
logCfg.File.Compressor = build.Gzip // Optional: or build.Zstd
40+
41+
if err := logRotator.InitLogRotator(logCfg.File, logFile); err != nil {
42+
return fmt.Errorf("failed to init log rotator: %w", err)
4343
}
4444

45-
pr, pw := io.Pipe()
46-
go func() {
47-
err := r.Run(pr)
48-
fmt.Println("unable to set up logs: ", err)
49-
}()
45+
// Create the log handlers (console + rotating file).
46+
logHandlers := build.NewDefaultLogHandlers(logCfg, logRotator)
47+
48+
// Create the subsystem logger manager.
49+
logManager := build.NewSubLoggerManager(logHandlers...)
50+
51+
// Create subsystem loggers.
52+
Logger = logManager.GenSubLogger("LNDMON", noOpShutdownFunc)
53+
htlcLogger = logManager.GenSubLogger("HTLC", noOpShutdownFunc)
54+
paymentLogger = logManager.GenSubLogger("PMNT", noOpShutdownFunc)
5055

51-
logWriter.RotatorPipe = pw
56+
// Set log level.
57+
// TODO: consider making this configurable.
58+
logManager.SetLogLevels("info")
5259

5360
return nil
5461
}

go.mod

Lines changed: 66 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,61 @@ module github.com/lightninglabs/lndmon
22

33
require (
44
github.com/btcsuite/btcd/btcutil v1.1.5
5-
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
5+
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c
66
github.com/jessevdk/go-flags v1.5.0
7-
github.com/jrick/logrotate v1.0.0
8-
github.com/lightninglabs/lndclient v0.18.0-6
9-
github.com/lightningnetwork/lnd v0.18.3-beta
7+
github.com/jrick/logrotate v1.1.2
8+
github.com/lightninglabs/lndclient v0.19.0-4
9+
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af
1010
github.com/prometheus/client_golang v1.18.0
11-
github.com/stretchr/testify v1.9.0
11+
github.com/stretchr/testify v1.10.0
1212
google.golang.org/grpc v1.59.0
1313
)
1414

1515
require (
16+
dario.cat/mergo v1.0.1 // indirect
1617
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
1718
github.com/Microsoft/go-winio v0.6.1 // indirect
1819
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
1920
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
2021
github.com/aead/siphash v1.0.1 // indirect
2122
github.com/beorn7/perks v1.0.1 // indirect
22-
github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240625142744-cc26860b4026 // indirect
23-
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
23+
github.com/btcsuite/btcd v0.24.3-0.20250318170759-4f4ea81776d6 // indirect
24+
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
2425
github.com/btcsuite/btcd/btcutil/psbt v1.1.8 // indirect
2526
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
26-
github.com/btcsuite/btcwallet v0.16.10-0.20240718224643-db3a4a2543bd // indirect
27-
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 // indirect
28-
github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 // indirect
29-
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 // indirect
30-
github.com/btcsuite/btcwallet/walletdb v1.4.2 // indirect
31-
github.com/btcsuite/btcwallet/wtxmgr v1.5.3 // indirect
27+
github.com/btcsuite/btclog/v2 v2.0.1-0.20250110154127-3ae4bf1cb318 // indirect
28+
github.com/btcsuite/btcwallet v0.16.13 // indirect
29+
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 // indirect
30+
github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 // indirect
31+
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 // indirect
32+
github.com/btcsuite/btcwallet/walletdb v1.5.1 // indirect
33+
github.com/btcsuite/btcwallet/wtxmgr v1.5.6 // indirect
3234
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
3335
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
3436
github.com/btcsuite/winsvc v1.0.0 // indirect
35-
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
37+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
3638
github.com/cespare/xxhash/v2 v2.2.0 // indirect
3739
github.com/containerd/continuity v0.3.0 // indirect
3840
github.com/coreos/go-semver v0.3.0 // indirect
3941
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
40-
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
42+
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
4143
github.com/davecgh/go-spew v1.1.1 // indirect
4244
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
4345
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
4446
github.com/decred/dcrd/lru v1.1.2 // indirect
45-
github.com/docker/cli v20.10.17+incompatible // indirect
46-
github.com/docker/docker v24.0.7+incompatible // indirect
47+
github.com/docker/cli v28.0.1+incompatible // indirect
48+
github.com/docker/docker v28.0.1+incompatible // indirect
4749
github.com/docker/go-connections v0.4.0 // indirect
4850
github.com/docker/go-units v0.5.0 // indirect
4951
github.com/dustin/go-humanize v1.0.1 // indirect
52+
github.com/felixge/httpsnoop v1.0.4 // indirect
5053
github.com/fergusstrange/embedded-postgres v1.25.0 // indirect
5154
github.com/go-errors/errors v1.0.1 // indirect
52-
github.com/go-logr/logr v1.3.0 // indirect
55+
github.com/go-logr/logr v1.4.2 // indirect
5356
github.com/go-logr/stdr v1.2.2 // indirect
57+
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
5458
github.com/gogo/protobuf v1.3.2 // indirect
55-
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
59+
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
5660
github.com/golang-migrate/migrate/v4 v4.17.0 // indirect
5761
github.com/golang/protobuf v1.5.3 // indirect
5862
github.com/golang/snappy v0.0.4 // indirect
@@ -63,11 +67,10 @@ require (
6367
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
6468
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
6569
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
66-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 // indirect
70+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
6771
github.com/hashicorp/errwrap v1.1.0 // indirect
6872
github.com/hashicorp/go-multierror v1.1.1 // indirect
6973
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
70-
github.com/imdario/mergo v0.3.12 // indirect
7174
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
7275
github.com/jackc/pgconn v1.14.3 // indirect
7376
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 // indirect
@@ -77,37 +80,40 @@ require (
7780
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
7881
github.com/jackc/pgtype v1.14.0 // indirect
7982
github.com/jackc/pgx/v4 v4.18.2 // indirect
80-
github.com/jackc/pgx/v5 v5.3.1 // indirect
83+
github.com/jackc/pgx/v5 v5.5.4 // indirect
84+
github.com/jackc/puddle/v2 v2.2.1 // indirect
8185
github.com/jonboulle/clockwork v0.2.2 // indirect
8286
github.com/json-iterator/go v1.1.12 // indirect
8387
github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect
8488
github.com/kkdai/bstream v1.0.0 // indirect
89+
github.com/klauspost/compress v1.17.9 // indirect
8590
github.com/lib/pq v1.10.9 // indirect
8691
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect
87-
github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd // indirect
92+
github.com/lightninglabs/neutrino v0.16.1 // indirect
8893
github.com/lightninglabs/neutrino/cache v1.1.2 // indirect
8994
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect
9095
github.com/lightningnetwork/lnd/clock v1.1.1 // indirect
91-
github.com/lightningnetwork/lnd/fn v1.2.0 // indirect
92-
github.com/lightningnetwork/lnd/healthcheck v1.2.5 // indirect
93-
github.com/lightningnetwork/lnd/kvdb v1.4.10 // indirect
96+
github.com/lightningnetwork/lnd/fn/v2 v2.0.8 // indirect
97+
github.com/lightningnetwork/lnd/healthcheck v1.2.6 // indirect
98+
github.com/lightningnetwork/lnd/kvdb v1.4.16 // indirect
9499
github.com/lightningnetwork/lnd/queue v1.1.1 // indirect
95-
github.com/lightningnetwork/lnd/sqldb v1.0.4 // indirect
100+
github.com/lightningnetwork/lnd/sqldb v1.0.9 // indirect
96101
github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect
97-
github.com/lightningnetwork/lnd/tlv v1.2.3 // indirect
98-
github.com/lightningnetwork/lnd/tor v1.1.2 // indirect
102+
github.com/lightningnetwork/lnd/tlv v1.3.0 // indirect
103+
github.com/lightningnetwork/lnd/tor v1.1.6 // indirect
99104
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect
100105
github.com/mattn/go-isatty v0.0.20 // indirect
101106
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
102107
github.com/miekg/dns v1.1.43 // indirect
103-
github.com/mitchellh/mapstructure v1.4.1 // indirect
108+
github.com/moby/docker-image-spec v1.3.1 // indirect
109+
github.com/moby/sys/user v0.3.0 // indirect
104110
github.com/moby/term v0.5.0 // indirect
105111
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
106112
github.com/modern-go/reflect2 v1.0.2 // indirect
107113
github.com/ncruces/go-strftime v0.1.9 // indirect
108114
github.com/opencontainers/go-digest v1.0.0 // indirect
109115
github.com/opencontainers/image-spec v1.0.2 // indirect
110-
github.com/opencontainers/runc v1.1.12 // indirect
116+
github.com/opencontainers/runc v1.2.0 // indirect
111117
github.com/ory/dockertest/v3 v3.10.0 // indirect
112118
github.com/pkg/errors v0.9.1 // indirect
113119
github.com/pmezard/go-difflib v1.0.0 // indirect
@@ -116,7 +122,7 @@ require (
116122
github.com/prometheus/procfs v0.12.0 // indirect
117123
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
118124
github.com/rogpeppe/fastuuid v1.2.0 // indirect
119-
github.com/sirupsen/logrus v1.9.2 // indirect
125+
github.com/sirupsen/logrus v1.9.3 // indirect
120126
github.com/soheilhy/cmux v0.1.5 // indirect
121127
github.com/spf13/pflag v1.0.5 // indirect
122128
github.com/stretchr/objx v0.5.2 // indirect
@@ -128,35 +134,36 @@ require (
128134
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
129135
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
130136
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
131-
go.etcd.io/bbolt v1.3.7 // indirect
132-
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
133-
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
134-
go.etcd.io/etcd/client/v2 v2.305.7 // indirect
135-
go.etcd.io/etcd/client/v3 v3.5.7 // indirect
136-
go.etcd.io/etcd/pkg/v3 v3.5.7 // indirect
137-
go.etcd.io/etcd/raft/v3 v3.5.7 // indirect
138-
go.etcd.io/etcd/server/v3 v3.5.7 // indirect
137+
go.etcd.io/bbolt v1.3.11 // indirect
138+
go.etcd.io/etcd/api/v3 v3.5.12 // indirect
139+
go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect
140+
go.etcd.io/etcd/client/v2 v2.305.12 // indirect
141+
go.etcd.io/etcd/client/v3 v3.5.12 // indirect
142+
go.etcd.io/etcd/pkg/v3 v3.5.12 // indirect
143+
go.etcd.io/etcd/raft/v3 v3.5.12 // indirect
144+
go.etcd.io/etcd/server/v3 v3.5.12 // indirect
145+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
139146
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
140-
go.opentelemetry.io/otel v1.20.0 // indirect
141-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.1 // indirect
142-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.1 // indirect
143-
go.opentelemetry.io/otel/metric v1.20.0 // indirect
144-
go.opentelemetry.io/otel/sdk v1.0.1 // indirect
145-
go.opentelemetry.io/otel/trace v1.20.0 // indirect
146-
go.opentelemetry.io/proto/otlp v0.9.0 // indirect
147+
go.opentelemetry.io/otel v1.35.0 // indirect
148+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
149+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
150+
go.opentelemetry.io/otel/metric v1.35.0 // indirect
151+
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
152+
go.opentelemetry.io/otel/trace v1.35.0 // indirect
153+
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
147154
go.uber.org/atomic v1.7.0 // indirect
148155
go.uber.org/multierr v1.6.0 // indirect
149156
go.uber.org/zap v1.17.0 // indirect
150-
golang.org/x/crypto v0.22.0 // indirect
157+
golang.org/x/crypto v0.35.0 // indirect
151158
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
152-
golang.org/x/mod v0.16.0 // indirect
153-
golang.org/x/net v0.24.0 // indirect
154-
golang.org/x/sync v0.7.0 // indirect
155-
golang.org/x/sys v0.19.0 // indirect
156-
golang.org/x/term v0.19.0 // indirect
157-
golang.org/x/text v0.14.0 // indirect
159+
golang.org/x/mod v0.17.0 // indirect
160+
golang.org/x/net v0.36.0 // indirect
161+
golang.org/x/sync v0.11.0 // indirect
162+
golang.org/x/sys v0.30.0 // indirect
163+
golang.org/x/term v0.29.0 // indirect
164+
golang.org/x/text v0.22.0 // indirect
158165
golang.org/x/time v0.3.0 // indirect
159-
golang.org/x/tools v0.19.0 // indirect
166+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
160167
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
161168
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
162169
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
@@ -174,11 +181,14 @@ require (
174181
modernc.org/sqlite v1.29.10 // indirect
175182
modernc.org/strutil v1.2.0 // indirect
176183
modernc.org/token v1.1.0 // indirect
184+
pgregory.net/rapid v1.2.0 // indirect
177185
sigs.k8s.io/yaml v1.2.0 // indirect
178186
)
179187

180188
// We want to format raw bytes as hex instead of base64. The forked version
181189
// allows us to specify that as an option.
182190
replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display
183191

184-
go 1.21.4
192+
go 1.23.6
193+
194+
toolchain go1.23.8

0 commit comments

Comments
 (0)