Skip to content

Commit b9eb2fd

Browse files
committed
Merge branch 'lnd-18-4'
2 parents 3473642 + e683d8a commit b9eb2fd

21 files changed

+1595
-724
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.19.x
19+
GO_VERSION: 1.22.x
2020

2121
jobs:
2222
build:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616

1717
# Dependency directories (remove the comment below to include it)
1818
# vendor/
19+
.idea

.golangci.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
run:
22
# timeout for analysis
3-
deadline: 4m
3+
timeout: 4m
44

55
linters-settings:
66
govet:
@@ -20,7 +20,7 @@ linters-settings:
2020
excludes:
2121
- G402 # Look for bad TLS connection settings.
2222
- G306 # Poor file permissions used when writing to a new file.
23-
staticcheck:
23+
staticcheck:
2424
go: "1.18"
2525
checks: ["-SA1019"]
2626

@@ -58,20 +58,10 @@ linters:
5858

5959
# Init functions are used by loggers throughout the codebase.
6060
- gochecknoinits
61-
61+
6262
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
6363
- errorlint
6464

65-
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
66-
- interfacer
67-
- golint
68-
- maligned
69-
- scopelint
70-
- varcheck
71-
- nosnakecase
72-
- structcheck
73-
- deadcode
74-
7565
# New linters that need a code adjustment first.
7666
- wrapcheck
7767
- nolintlint
@@ -88,10 +78,8 @@ linters:
8878
- containedctx
8979
- contextcheck
9080
- errname
91-
- exhaustivestruct
92-
- goerr113
81+
- err113
9382
- gomnd
94-
- ifshort
9583
- noctx
9684
- nestif
9785
- wsl
@@ -104,4 +92,12 @@ linters:
10492
- exhaustruct
10593
- importas
10694
- interfacebloat
95+
- protogetter
96+
- revive
97+
- depguard
98+
- mnd
99+
- perfsprint
100+
- inamedparam
107101

102+
# Disabled disabled because the Go version (1.21.4) of the project < 1.22.
103+
- copyloopvar

chainkit_client.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414

1515
// ChainKitClient exposes chain functionality.
1616
type ChainKitClient interface {
17+
ServiceClient[chainrpc.ChainKitClient]
18+
1719
// GetBlock returns a block given the corresponding block hash.
1820
GetBlock(ctx context.Context, hash chainhash.Hash) (*wire.MsgBlock,
1921
error)
@@ -41,6 +43,10 @@ type chainKitClient struct {
4143
wg sync.WaitGroup
4244
}
4345

46+
// A compile time check to ensure that chainKitClient implements the
47+
// ChainKitClient interface.
48+
var _ ChainKitClient = (*chainKitClient)(nil)
49+
4450
func newChainKitClient(conn grpc.ClientConnInterface,
4551
chainMac serializedMacaroon, timeout time.Duration) *chainKitClient {
4652

@@ -55,6 +61,15 @@ func (s *chainKitClient) WaitForFinished() {
5561
s.wg.Wait()
5662
}
5763

64+
// RawClientWithMacAuth returns a context with the proper macaroon
65+
// authentication, the default RPC timeout, and the raw client.
66+
func (s *chainKitClient) RawClientWithMacAuth(
67+
parentCtx context.Context) (context.Context, time.Duration,
68+
chainrpc.ChainKitClient) {
69+
70+
return s.chainMac.WithMacaroonAuth(parentCtx), s.timeout, s.client
71+
}
72+
5873
// GetBlock returns a block given the corresponding block hash.
5974
func (s *chainKitClient) GetBlock(ctxParent context.Context,
6075
hash chainhash.Hash) (*wire.MsgBlock, error) {

chainnotifier_client.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ func WithReOrgChan(reOrgChan chan struct{}) NotifierOption {
6060

6161
// ChainNotifierClient exposes base lightning functionality.
6262
type ChainNotifierClient interface {
63+
ServiceClient[chainrpc.ChainNotifierClient]
64+
6365
RegisterBlockEpochNtfn(ctx context.Context) (
6466
chan int32, chan error, error)
6567

@@ -81,6 +83,10 @@ type chainNotifierClient struct {
8183
wg sync.WaitGroup
8284
}
8385

86+
// A compile time check to ensure that chainNotifierClient implements the
87+
// ChainNotifierClient interface.
88+
var _ ChainNotifierClient = (*chainNotifierClient)(nil)
89+
8490
func newChainNotifierClient(conn grpc.ClientConnInterface,
8591
chainMac serializedMacaroon, timeout time.Duration) *chainNotifierClient {
8692

@@ -95,6 +101,15 @@ func (s *chainNotifierClient) WaitForFinished() {
95101
s.wg.Wait()
96102
}
97103

104+
// RawClientWithMacAuth returns a context with the proper macaroon
105+
// authentication, the default RPC timeout, and the raw client.
106+
func (s *chainNotifierClient) RawClientWithMacAuth(
107+
parentCtx context.Context) (context.Context, time.Duration,
108+
chainrpc.ChainNotifierClient) {
109+
110+
return s.chainMac.WithMacaroonAuth(parentCtx), s.timeout, s.client
111+
}
112+
98113
func (s *chainNotifierClient) RegisterSpendNtfn(ctx context.Context,
99114
outpoint *wire.OutPoint, pkScript []byte, heightHint int32) (
100115
chan *chainntnfs.SpendDetail, chan error, error) {

go.mod

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,85 @@
11
module github.com/lightninglabs/lndclient
22

33
require (
4-
github.com/btcsuite/btcd v0.24.2-beta.rc1
5-
github.com/btcsuite/btcd/btcec/v2 v2.3.2
4+
github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53
5+
github.com/btcsuite/btcd/btcec/v2 v2.3.4
66
github.com/btcsuite/btcd/btcutil v1.1.5
77
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
88
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
9-
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
10-
github.com/btcsuite/btcwallet v0.16.10-0.20240127010340-16b422a2e8bf
11-
github.com/btcsuite/btcwallet/wtxmgr v1.5.0
12-
github.com/lightningnetwork/lnd v0.17.4-beta
13-
github.com/lightningnetwork/lnd/kvdb v1.4.4
14-
github.com/stretchr/testify v1.8.4
9+
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c
10+
github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5
11+
github.com/btcsuite/btcwallet/wtxmgr v1.5.4
12+
github.com/lightningnetwork/lnd v0.18.4-beta
13+
github.com/lightningnetwork/lnd/kvdb v1.4.10
14+
github.com/stretchr/testify v1.9.0
1515
google.golang.org/grpc v1.59.0
1616
gopkg.in/macaroon-bakery.v2 v2.0.1
1717
gopkg.in/macaroon.v2 v2.1.0
1818
)
1919

2020
require (
21+
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
22+
github.com/Microsoft/go-winio v0.6.1 // indirect
23+
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
2124
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
2225
github.com/aead/siphash v1.0.1 // indirect
23-
github.com/andybalholm/brotli v1.0.3 // indirect
2426
github.com/beorn7/perks v1.0.1 // indirect
25-
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2 // indirect
26-
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 // indirect
27-
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3 // indirect
28-
github.com/btcsuite/btcwallet/walletdb v1.4.0 // indirect
27+
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 // indirect
28+
github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 // indirect
29+
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 // indirect
30+
github.com/btcsuite/btcwallet/walletdb v1.4.4 // indirect
2931
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
3032
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
3133
github.com/btcsuite/winsvc v1.0.0 // indirect
3234
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
3335
github.com/cespare/xxhash/v2 v2.2.0 // indirect
36+
github.com/containerd/continuity v0.3.0 // indirect
3437
github.com/coreos/go-semver v0.3.0 // indirect
3538
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
3639
github.com/davecgh/go-spew v1.1.1 // indirect
37-
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
38-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
39-
github.com/decred/dcrd/lru v1.0.0 // indirect
40-
github.com/dsnet/compress v0.0.1 // indirect
41-
github.com/dustin/go-humanize v1.0.0 // indirect
42-
github.com/fergusstrange/embedded-postgres v1.10.0 // indirect
40+
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
41+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
42+
github.com/decred/dcrd/lru v1.1.2 // indirect
43+
github.com/docker/cli v20.10.17+incompatible // indirect
44+
github.com/docker/docker v24.0.7+incompatible // indirect
45+
github.com/docker/go-connections v0.4.0 // indirect
46+
github.com/docker/go-units v0.5.0 // indirect
47+
github.com/dustin/go-humanize v1.0.1 // indirect
48+
github.com/fergusstrange/embedded-postgres v1.25.0 // indirect
4349
github.com/go-errors/errors v1.0.1 // indirect
4450
github.com/go-logr/logr v1.3.0 // indirect
4551
github.com/go-logr/stdr v1.2.2 // indirect
4652
github.com/gofrs/uuid v4.2.0+incompatible // indirect
4753
github.com/gogo/protobuf v1.3.2 // indirect
4854
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
55+
github.com/golang-migrate/migrate/v4 v4.17.0 // indirect
4956
github.com/golang/protobuf v1.5.3 // indirect
5057
github.com/golang/snappy v0.0.4 // indirect
5158
github.com/google/btree v1.0.1 // indirect
52-
github.com/google/uuid v1.3.1 // indirect
59+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
60+
github.com/google/uuid v1.6.0 // indirect
5361
github.com/gorilla/websocket v1.5.0 // indirect
5462
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
5563
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
5664
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
5765
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 // indirect
66+
github.com/hashicorp/errwrap v1.1.0 // indirect
67+
github.com/hashicorp/go-multierror v1.1.1 // indirect
68+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
69+
github.com/imdario/mergo v0.3.12 // indirect
5870
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
5971
github.com/jackc/pgconn v1.14.3 // indirect
60-
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect
72+
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 // indirect
6173
github.com/jackc/pgio v1.0.0 // indirect
6274
github.com/jackc/pgpassfile v1.0.0 // indirect
6375
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
6476
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
6577
github.com/jackc/pgtype v1.14.0 // indirect
6678
github.com/jackc/pgx/v4 v4.18.2 // indirect
79+
github.com/jackc/pgx/v5 v5.3.1 // indirect
6780
github.com/jessevdk/go-flags v1.4.0 // indirect
6881
github.com/jonboulle/clockwork v0.2.2 // indirect
69-
github.com/jrick/logrotate v1.0.0 // indirect
82+
github.com/jrick/logrotate v1.1.2 // indirect
7083
github.com/json-iterator/go v1.1.11 // indirect
7184
github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a // indirect
7285
github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a // indirect
@@ -76,47 +89,53 @@ require (
7689
github.com/juju/retry v0.0.0-20220204093819-62423bf33287 // indirect
7790
github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0 // indirect
7891
github.com/juju/version/v2 v2.0.0-20220204124744-fc9915e3d935 // indirect
79-
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
8092
github.com/kkdai/bstream v1.0.0 // indirect
81-
github.com/klauspost/compress v1.13.6 // indirect
82-
github.com/klauspost/pgzip v1.2.5 // indirect
83-
github.com/lib/pq v1.10.3 // indirect
93+
github.com/lib/pq v1.10.9 // indirect
8494
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect
85-
github.com/lightninglabs/neutrino v0.16.0 // indirect
86-
github.com/lightninglabs/neutrino/cache v1.1.1 // indirect
87-
github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f // indirect
95+
github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd // indirect
96+
github.com/lightninglabs/neutrino/cache v1.1.2 // indirect
97+
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect
8898
github.com/lightningnetwork/lnd/clock v1.1.1 // indirect
89-
github.com/lightningnetwork/lnd/healthcheck v1.2.3 // indirect
99+
github.com/lightningnetwork/lnd/fn v1.2.3 // indirect
100+
github.com/lightningnetwork/lnd/healthcheck v1.2.5 // indirect
90101
github.com/lightningnetwork/lnd/queue v1.1.1 // indirect
102+
github.com/lightningnetwork/lnd/sqldb v1.0.4 // indirect
91103
github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect
92-
github.com/lightningnetwork/lnd/tlv v1.1.1 // indirect
104+
github.com/lightningnetwork/lnd/tlv v1.2.6 // indirect
93105
github.com/lightningnetwork/lnd/tor v1.1.2 // indirect
94106
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect
95-
github.com/mattn/go-isatty v0.0.16 // indirect
107+
github.com/mattn/go-isatty v0.0.20 // indirect
96108
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
97-
github.com/mholt/archiver/v3 v3.5.0 // indirect
98109
github.com/miekg/dns v1.1.43 // indirect
110+
github.com/mitchellh/mapstructure v1.4.1 // indirect
111+
github.com/moby/term v0.5.0 // indirect
99112
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
100113
github.com/modern-go/reflect2 v1.0.1 // indirect
101-
github.com/nwaples/rardecode v1.1.2 // indirect
102-
github.com/pierrec/lz4/v4 v4.1.8 // indirect
114+
github.com/ncruces/go-strftime v0.1.9 // indirect
115+
github.com/opencontainers/go-digest v1.0.0 // indirect
116+
github.com/opencontainers/image-spec v1.0.2 // indirect
117+
github.com/opencontainers/runc v1.1.12 // indirect
118+
github.com/ory/dockertest/v3 v3.10.0 // indirect
119+
github.com/pkg/errors v0.9.1 // indirect
103120
github.com/pmezard/go-difflib v1.0.0 // indirect
104121
github.com/prometheus/client_golang v1.11.1 // indirect
105122
github.com/prometheus/client_model v0.2.0 // indirect
106123
github.com/prometheus/common v0.26.0 // indirect
107124
github.com/prometheus/procfs v0.6.0 // indirect
108-
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
125+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
109126
github.com/rogpeppe/fastuuid v1.2.0 // indirect
110127
github.com/sirupsen/logrus v1.9.2 // indirect
111128
github.com/soheilhy/cmux v0.1.5 // indirect
112129
github.com/spf13/pflag v1.0.5 // indirect
113-
github.com/stretchr/objx v0.5.0 // indirect
130+
github.com/stretchr/objx v0.5.2 // indirect
114131
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
115132
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
116-
github.com/ulikunitz/xz v0.5.11 // indirect
133+
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
134+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
135+
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
117136
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
118137
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
119-
go.etcd.io/bbolt v1.3.7 // indirect
138+
go.etcd.io/bbolt v1.3.11 // indirect
120139
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
121140
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
122141
go.etcd.io/etcd/client/v2 v2.305.7 // indirect
@@ -135,38 +154,38 @@ require (
135154
go.uber.org/atomic v1.7.0 // indirect
136155
go.uber.org/multierr v1.6.0 // indirect
137156
go.uber.org/zap v1.17.0 // indirect
138-
golang.org/x/crypto v0.21.0 // indirect
139-
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
140-
golang.org/x/mod v0.10.0 // indirect
141-
golang.org/x/net v0.23.0 // indirect
142-
golang.org/x/sys v0.18.0 // indirect
143-
golang.org/x/term v0.18.0 // indirect
157+
golang.org/x/crypto v0.22.0 // indirect
158+
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
159+
golang.org/x/mod v0.16.0 // indirect
160+
golang.org/x/net v0.24.0 // indirect
161+
golang.org/x/sync v0.7.0 // indirect
162+
golang.org/x/sys v0.19.0 // indirect
163+
golang.org/x/term v0.19.0 // indirect
144164
golang.org/x/text v0.14.0 // indirect
145-
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
146-
golang.org/x/tools v0.9.1 // indirect
147-
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
148-
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
149-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
165+
golang.org/x/time v0.3.0 // indirect
166+
golang.org/x/tools v0.19.0 // indirect
167+
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
168+
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
169+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
150170
google.golang.org/protobuf v1.33.0 // indirect
151171
gopkg.in/errgo.v1 v1.0.1 // indirect
152172
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
153173
gopkg.in/yaml.v2 v2.4.0 // indirect
154174
gopkg.in/yaml.v3 v3.0.1 // indirect
155-
lukechampine.com/uint128 v1.2.0 // indirect
156-
modernc.org/cc/v3 v3.40.0 // indirect
157-
modernc.org/ccgo/v3 v3.16.13 // indirect
158-
modernc.org/libc v1.22.2 // indirect
159-
modernc.org/mathutil v1.5.0 // indirect
160-
modernc.org/memory v1.4.0 // indirect
161-
modernc.org/opt v0.1.3 // indirect
162-
modernc.org/sqlite v1.20.3 // indirect
163-
modernc.org/strutil v1.1.3 // indirect
164-
modernc.org/token v1.0.1 // indirect
175+
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
176+
modernc.org/libc v1.49.3 // indirect
177+
modernc.org/mathutil v1.6.0 // indirect
178+
modernc.org/memory v1.8.0 // indirect
179+
modernc.org/sqlite v1.29.10 // indirect
180+
modernc.org/strutil v1.2.0 // indirect
181+
modernc.org/token v1.1.0 // indirect
165182
sigs.k8s.io/yaml v1.2.0 // indirect
166183
)
167184

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

172-
go 1.19
189+
go 1.22.6
190+
191+
toolchain go1.22.7

0 commit comments

Comments
 (0)