Skip to content

Commit 357d6e2

Browse files
committed
Update to Go to 1.21 and project dependencies
1 parent a03710f commit 357d6e2

File tree

9 files changed

+686
-1050
lines changed

9 files changed

+686
-1050
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.18.4
19+
GO_VERSION: 1.21.6
2020

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

.golangci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,20 @@ linters:
2222
- bodyclose
2323
- deadcode
2424
- decorder
25-
- depguard
2625
- dupl
2726
- durationcheck
2827
- errcheck
2928
- errchkjson
3029
- execinquery
3130
- exportloopref
32-
- goconst
3331
- gocritic
3432
- godot
3533
- goheader
3634
- goimports
3735
- gomodguard
3836
- goprintffuncname
39-
- gosec
37+
# TODO address issues with gosec and enable.
38+
# - gosec
4039
- gosimple
4140
- govet
4241
- grouper

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
FROM golang:1.18-alpine as builder
1+
# If you change this value, please change it in the following files as well:
2+
# /Dockerfile
3+
# /tools/Dockerfile
4+
# /.github/workflows/main.yml
5+
FROM golang:1.21.6-alpine as builder
26

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

collectors/htlcs_collector.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ func (h *htlcMonitor) consumeHtlcEvents() error {
183183
return nil
184184
}
185185

186-
// processHtlcEvent processes all the htlc events we consume from our stream.
187-
func (h *htlcMonitor) processHtlcEvent(event *routerrpc.HtlcEvent) error {
186+
// getKeyAndTimestamp is a helper function that extracts the key and timestamp from an event.
187+
func getKeyAndTimestamp(event *routerrpc.HtlcEvent) (htlcswitch.HtlcKey, time.Time) {
188188
key := htlcswitch.HtlcKey{
189189
IncomingCircuit: invoices.CircuitKey{
190190
ChanID: lnwire.NewShortChanIDFromInt(
@@ -202,12 +202,18 @@ func (h *htlcMonitor) processHtlcEvent(event *routerrpc.HtlcEvent) error {
202202

203203
ts := time.Unix(0, int64(event.TimestampNs))
204204

205+
return key, ts
206+
}
207+
208+
// processHtlcEvent processes all the htlc events we consume from our stream.
209+
func (h *htlcMonitor) processHtlcEvent(event *routerrpc.HtlcEvent) error {
205210
switch e := event.Event.(type) {
206211
// If we have received a forwarding event, we add it to our map if it
207212
// is not already present. We are ok with duplicate events, because
208213
// htlcs are sometimes replayed by the switch, but we want to keep our
209214
// earliest timestamp for stats.
210215
case *routerrpc.HtlcEvent_ForwardEvent:
216+
key, ts := getKeyAndTimestamp(event)
211217
if _, ok := h.activeHtlcs[key]; ok {
212218
htlcLogger.Infof("htlc: %v replayed", key)
213219
return nil
@@ -217,12 +223,14 @@ func (h *htlcMonitor) processHtlcEvent(event *routerrpc.HtlcEvent) error {
217223
h.activeHtlcs[key] = ts
218224

219225
case *routerrpc.HtlcEvent_SettleEvent:
226+
key, ts := getKeyAndTimestamp(event)
220227
err := h.recordResolution(key, event.EventType, ts, "")
221228
if err != nil {
222229
return err
223230
}
224231

225232
case *routerrpc.HtlcEvent_ForwardFailEvent:
233+
key, ts := getKeyAndTimestamp(event)
226234
err := h.recordResolution(
227235
key, event.EventType, ts, failureReasonExternal,
228236
)
@@ -231,6 +239,7 @@ func (h *htlcMonitor) processHtlcEvent(event *routerrpc.HtlcEvent) error {
231239
}
232240

233241
case *routerrpc.HtlcEvent_LinkFailEvent:
242+
key, ts := getKeyAndTimestamp(event)
234243
err := h.recordResolution(
235244
key, event.EventType, ts, e.LinkFailEvent.FailureString,
236245
)

go.mod

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
module github.com/lightninglabs/lndmon
22

33
require (
4-
github.com/btcsuite/btcd/btcutil v1.1.3
4+
github.com/btcsuite/btcd/btcutil v1.1.5
55
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
6-
github.com/jessevdk/go-flags v1.4.0
6+
github.com/jessevdk/go-flags v1.5.0
77
github.com/jrick/logrotate v1.0.0
8-
github.com/lightninglabs/lndclient v0.16.0-8
9-
github.com/lightningnetwork/lnd v0.16.0-beta.rc1
10-
github.com/prometheus/client_golang v1.11.1
11-
github.com/stretchr/testify v1.8.1
8+
github.com/lightninglabs/lndclient v0.17.0-4
9+
github.com/lightningnetwork/lnd v0.17.3-beta
10+
github.com/prometheus/client_golang v1.18.0
11+
github.com/stretchr/testify v1.8.4
1212
)
1313

1414
require (
1515
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
1616
github.com/aead/siphash v1.0.1 // indirect
1717
github.com/andybalholm/brotli v1.0.3 // indirect
1818
github.com/beorn7/perks v1.0.1 // indirect
19-
github.com/btcsuite/btcd v0.23.5-0.20230125025938-be056b0a0b2f // indirect
19+
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd // indirect
2020
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
21-
github.com/btcsuite/btcd/btcutil/psbt v1.1.5 // indirect
22-
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
23-
github.com/btcsuite/btcwallet v0.16.7 // indirect
21+
github.com/btcsuite/btcd/btcutil/psbt v1.1.8 // indirect
22+
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
23+
github.com/btcsuite/btcwallet v0.16.10-0.20231129183218-5df09dd43358 // indirect
2424
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2 // indirect
2525
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 // indirect
2626
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3 // indirect
@@ -29,10 +29,10 @@ require (
2929
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
3030
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
3131
github.com/btcsuite/winsvc v1.0.0 // indirect
32-
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
33-
github.com/cespare/xxhash/v2 v2.1.1 // indirect
32+
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
33+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
3434
github.com/coreos/go-semver v0.3.0 // indirect
35-
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
35+
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
3636
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
3737
github.com/davecgh/go-spew v1.1.1 // indirect
3838
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
@@ -44,68 +44,69 @@ require (
4444
github.com/go-errors/errors v1.0.1 // indirect
4545
github.com/gogo/protobuf v1.3.2 // indirect
4646
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
47-
github.com/golang/protobuf v1.5.2 // indirect
47+
github.com/golang/protobuf v1.5.3 // indirect
4848
github.com/golang/snappy v0.0.4 // indirect
4949
github.com/google/btree v1.0.1 // indirect
5050
github.com/google/uuid v1.3.0 // indirect
51-
github.com/gorilla/websocket v1.4.2 // indirect
51+
github.com/gorilla/websocket v1.5.0 // indirect
5252
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
5353
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
5454
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
5555
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 // indirect
5656
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
57-
github.com/jackc/pgconn v1.10.0 // indirect
57+
github.com/jackc/pgconn v1.14.0 // indirect
58+
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect
5859
github.com/jackc/pgio v1.0.0 // indirect
5960
github.com/jackc/pgpassfile v1.0.0 // indirect
60-
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
61-
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
62-
github.com/jackc/pgtype v1.8.1 // indirect
63-
github.com/jackc/pgx/v4 v4.13.0 // indirect
61+
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
62+
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
63+
github.com/jackc/pgtype v1.14.0 // indirect
64+
github.com/jackc/pgx/v4 v4.18.1 // indirect
6465
github.com/jonboulle/clockwork v0.2.2 // indirect
65-
github.com/json-iterator/go v1.1.11 // indirect
66+
github.com/json-iterator/go v1.1.12 // indirect
6667
github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect
6768
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
6869
github.com/kkdai/bstream v1.0.0 // indirect
6970
github.com/klauspost/compress v1.13.6 // indirect
7071
github.com/klauspost/pgzip v1.2.5 // indirect
7172
github.com/lib/pq v1.10.3 // indirect
7273
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect
73-
github.com/lightninglabs/neutrino v0.15.0 // indirect
74-
github.com/lightninglabs/neutrino/cache v1.1.0 // indirect
75-
github.com/lightningnetwork/lightning-onion v1.2.1-0.20221202012345-ca23184850a1 // indirect
76-
github.com/lightningnetwork/lnd/clock v1.1.0 // indirect
77-
github.com/lightningnetwork/lnd/healthcheck v1.2.2 // indirect
78-
github.com/lightningnetwork/lnd/kvdb v1.4.1 // indirect
79-
github.com/lightningnetwork/lnd/queue v1.1.0 // indirect
80-
github.com/lightningnetwork/lnd/ticker v1.1.0 // indirect
81-
github.com/lightningnetwork/lnd/tlv v1.1.0 // indirect
82-
github.com/lightningnetwork/lnd/tor v1.1.0 // indirect
74+
github.com/lightninglabs/neutrino v0.16.0 // indirect
75+
github.com/lightninglabs/neutrino/cache v1.1.1 // indirect
76+
github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f // indirect
77+
github.com/lightningnetwork/lnd/clock v1.1.1 // indirect
78+
github.com/lightningnetwork/lnd/healthcheck v1.2.3 // indirect
79+
github.com/lightningnetwork/lnd/kvdb v1.4.4 // indirect
80+
github.com/lightningnetwork/lnd/queue v1.1.1 // indirect
81+
github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect
82+
github.com/lightningnetwork/lnd/tlv v1.1.1 // indirect
83+
github.com/lightningnetwork/lnd/tor v1.1.2 // indirect
8384
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect
8485
github.com/mattn/go-isatty v0.0.16 // indirect
85-
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
86+
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
8687
github.com/mholt/archiver/v3 v3.5.0 // indirect
8788
github.com/miekg/dns v1.1.43 // indirect
8889
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
89-
github.com/modern-go/reflect2 v1.0.1 // indirect
90+
github.com/modern-go/reflect2 v1.0.2 // indirect
9091
github.com/nwaples/rardecode v1.1.2 // indirect
9192
github.com/pierrec/lz4/v4 v4.1.8 // indirect
9293
github.com/pmezard/go-difflib v1.0.0 // indirect
93-
github.com/prometheus/client_model v0.2.0 // indirect
94-
github.com/prometheus/common v0.26.0 // indirect
95-
github.com/prometheus/procfs v0.6.0 // indirect
94+
github.com/prometheus/client_model v0.5.0 // indirect
95+
github.com/prometheus/common v0.45.0 // indirect
96+
github.com/prometheus/procfs v0.12.0 // indirect
9697
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
9798
github.com/rogpeppe/fastuuid v1.2.0 // indirect
98-
github.com/sirupsen/logrus v1.7.0 // indirect
99+
github.com/sirupsen/logrus v1.9.2 // indirect
99100
github.com/soheilhy/cmux v0.1.5 // indirect
100101
github.com/spf13/pflag v1.0.5 // indirect
101102
github.com/stretchr/objx v0.5.0 // indirect
102103
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
103104
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
104-
github.com/ulikunitz/xz v0.5.10 // indirect
105-
github.com/xdg-go/stringprep v1.0.3 // indirect
105+
github.com/ulikunitz/xz v0.5.11 // indirect
106+
github.com/xdg-go/stringprep v1.0.4 // indirect
106107
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
107108
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
108-
go.etcd.io/bbolt v1.3.6 // indirect
109+
go.etcd.io/bbolt v1.3.7 // indirect
109110
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
110111
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
111112
go.etcd.io/etcd/client/v2 v2.305.7 // indirect
@@ -123,18 +124,18 @@ require (
123124
go.uber.org/atomic v1.7.0 // indirect
124125
go.uber.org/multierr v1.6.0 // indirect
125126
go.uber.org/zap v1.17.0 // indirect
126-
golang.org/x/crypto v0.1.0 // indirect
127-
golang.org/x/exp v0.0.0-20221111094246-ab4555d3164f // indirect
128-
golang.org/x/mod v0.6.0 // indirect
129-
golang.org/x/net v0.4.0 // indirect
130-
golang.org/x/sys v0.3.0 // indirect
131-
golang.org/x/term v0.3.0 // indirect
132-
golang.org/x/text v0.5.0 // indirect
133-
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
134-
golang.org/x/tools v0.2.0 // indirect
135-
google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced // indirect
136-
google.golang.org/grpc v1.41.0 // indirect
137-
google.golang.org/protobuf v1.27.1 // indirect
127+
golang.org/x/crypto v0.14.0 // indirect
128+
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
129+
golang.org/x/mod v0.10.0 // indirect
130+
golang.org/x/net v0.17.0 // indirect
131+
golang.org/x/sys v0.15.0 // indirect
132+
golang.org/x/term v0.13.0 // indirect
133+
golang.org/x/text v0.13.0 // indirect
134+
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
135+
golang.org/x/tools v0.9.1 // indirect
136+
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
137+
google.golang.org/grpc v1.56.3 // indirect
138+
google.golang.org/protobuf v1.31.0 // indirect
138139
gopkg.in/errgo.v1 v1.0.1 // indirect
139140
gopkg.in/macaroon-bakery.v2 v2.0.1 // indirect
140141
gopkg.in/macaroon.v2 v2.1.0 // indirect
@@ -154,4 +155,8 @@ require (
154155
sigs.k8s.io/yaml v1.2.0 // indirect
155156
)
156157

157-
go 1.19
158+
// We want to format raw bytes as hex instead of base64. The forked version
159+
// allows us to specify that as an option.
160+
replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display
161+
162+
go 1.21

0 commit comments

Comments
 (0)