Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.22', '1.23']
go: ['1.24', '1.25']
steps:
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 #v5.0.2
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: ${{ matrix.go }}
- name: Check out source
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
- name: Install Linters
run: "go install github.com/golangci/golangci-lint/cmd/[email protected]"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: golangci-lint
uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # v9.0.0
with:
install-mode: "goinstall"
version: 9f61b0f53f80672872fced07b6874397c3ed197b # v2.7.2
- name: Build
run: go build ./...
- name: Lint
run: golangci-lint run
15 changes: 8 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "2"
run:
deadline: 15m

timeout: 10m
linters:
disable-all: true
default: none
enable:
- asciicheck
- bidichk
Expand All @@ -12,9 +12,6 @@ linters:
- dupword
- durationcheck
- errchkjson
- gofmt
- goimports
- gosimple
- govet
- grouper
- ineffassign
Expand All @@ -25,7 +22,11 @@ linters:
- reassign
- rowserrcheck
- sqlclosecheck
- staticcheck
- tparallel
- typecheck
- unconvert
- unused
formatters:
enable:
- gofmt
- goimports
1 change: 1 addition & 0 deletions client/lpdclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func (c *Client) RequestChannel(ctx context.Context, channelSize uint64) error {
PaymentRequest: invoiceRes.Invoice,
FeeLimit: &lnrpc.FeeLimit{Limit: &lnrpc.FeeLimit_Fixed{Fixed: feeLimitAtoms}},
}
// nolint:staticcheck
payStream, err := c.lc.SendPayment(ctx)
if err != nil {
return err
Expand Down
9 changes: 2 additions & 7 deletions cmd/client/util.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package main

import (
"context"
"fmt"
"os"
"time"

"github.com/decred/dcrlnd/macaroons"
"google.golang.org/grpc"
Expand Down Expand Up @@ -38,15 +36,12 @@ func connectToDcrlnd(addr, tlsCertPath, macaroonPath string) (*grpc.ClientConn,
opts = append(
opts,
grpc.WithPerRPCCredentials(macOpt),
grpc.WithBlock(),
)

// Block until connection happens or fail.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
conn, err := grpc.DialContext(ctx, addr, opts...)
conn, err := grpc.NewClient(addr, opts...)
if err != nil {
return nil, fmt.Errorf("unable to dial to dcrlnd's gRPC server: %v", err)
return nil, fmt.Errorf("unable to create gRPC client for %v: %v", addr, err)
}
return conn, nil
}
14 changes: 4 additions & 10 deletions config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"crypto/tls"
_ "embed"
"errors"
Expand Down Expand Up @@ -164,10 +165,11 @@ type config struct {

// listeners returns the interface listeners where connections to the http
// server should be accepted.
func (c *config) listeners() ([]net.Listener, error) {
func (c *config) listeners(ctx context.Context) ([]net.Listener, error) {

listenFunc := func(addr string) (net.Listener, error) {
return net.Listen("tcp", addr)
var lc net.ListenConfig
return lc.Listen(ctx, "tcp", addr)
}

if !c.DisableTLS {
Expand Down Expand Up @@ -677,14 +679,6 @@ func loadConfig() (*config, []string, error) {
cfg.LNTLSCertPath = cleanAndExpandPath(cfg.LNTLSCertPath)
cfg.LNMacaroonPath = cleanAndExpandPath(cfg.LNMacaroonPath)

// Attempt an early connection to the dcrlnd server and verify if it's a
// reasonable server for operations.
err = server.CheckDcrlnd(cfg.LNRPCHost, cfg.LNTLSCertPath, cfg.LNMacaroonPath)
if err != nil {
return nil, nil, fmt.Errorf("error while checking underlying "+
"dcrlnd node: %v", err)
}

// Warn about missing config file only after all other configuration is
// done. This prevents the warning on help messages and invalid
// options. Note this should go directly before the return.
Expand Down
111 changes: 58 additions & 53 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,76 +1,80 @@
module github.com/decred/dcrlnlpd

go 1.22
go 1.24.0

require (
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/chaincfg/chainhash v1.0.4
github.com/decred/dcrd/chaincfg/v3 v3.2.1
github.com/decred/dcrd/dcrutil/v4 v4.0.2
github.com/decred/dcrd/wire v1.7.0
github.com/decred/dcrlnd v0.7.4
github.com/decred/dcrd/chaincfg/chainhash v1.0.5
github.com/decred/dcrd/chaincfg/v3 v3.3.0
github.com/decred/dcrd/dcrutil/v4 v4.0.3
github.com/decred/dcrd/wire v1.7.2
github.com/decred/dcrlnd v0.8.2-0.20251215215714-d88122fa6129
github.com/decred/slog v1.2.0
github.com/gorilla/mux v1.8.1
github.com/jessevdk/go-flags v1.6.1
github.com/jrick/logrotate v1.0.0
golang.org/x/sync v0.8.0
google.golang.org/grpc v1.59.0
github.com/jrick/logrotate v1.1.2
golang.org/x/sync v0.19.0
google.golang.org/grpc v1.76.0
gopkg.in/macaroon.v2 v2.1.0
)

require (
decred.org/cspp/v2 v2.2.0 // indirect
decred.org/dcrwallet/v4 v4.1.3 // indirect
decred.org/cspp/v2 v2.4.0 // indirect
decred.org/dcrwallet/v5 v5.0.2 // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcwallet/walletdb v1.4.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/companyzero/sntrup4591761 v0.0.0-20220309191932-9e0f3af2f07a // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/dchest/siphash v1.2.3 // indirect
github.com/decred/base58 v1.0.5 // indirect
github.com/decred/dcrd v1.8.0 // indirect
github.com/decred/dcrd/addrmgr/v2 v2.0.4 // indirect
github.com/decred/dcrd/bech32 v1.1.3 // indirect
github.com/decred/dcrd/blockchain/stake/v5 v5.0.1 // indirect
github.com/decred/dcrd/blockchain/standalone/v2 v2.2.1 // indirect
github.com/decred/base58 v1.0.6 // indirect
github.com/decred/dcrd v1.10.0 // indirect
github.com/decred/dcrd/addrmgr/v3 v3.0.0 // indirect
github.com/decred/dcrd/bech32 v1.1.4 // indirect
github.com/decred/dcrd/blockchain/stake/v5 v5.0.2 // indirect
github.com/decred/dcrd/blockchain/standalone/v2 v2.2.2 // indirect
github.com/decred/dcrd/certgen v1.2.0 // indirect
github.com/decred/dcrd/chaincfg v1.5.2 // indirect
github.com/decred/dcrd/connmgr v1.1.1 // indirect
github.com/decred/dcrd/connmgr/v3 v3.1.2 // indirect
github.com/decred/dcrd/connmgr/v3 v3.1.3 // indirect
github.com/decred/dcrd/container/apbf v1.0.1 // indirect
github.com/decred/dcrd/container/lru v1.0.0 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/crypto/rand v1.0.0 // indirect
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
github.com/decred/dcrd/crypto/rand v1.0.1 // indirect
github.com/decred/dcrd/crypto/ripemd160 v1.0.2 // indirect
github.com/decred/dcrd/database/v3 v3.0.2 // indirect
github.com/decred/dcrd/database/v3 v3.0.3 // indirect
github.com/decred/dcrd/dcrec v1.0.1 // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/decred/dcrd/dcrjson/v4 v4.1.0 // indirect
github.com/decred/dcrd/gcs/v4 v4.1.0 // indirect
github.com/decred/dcrd/hdkeychain/v3 v3.1.2 // indirect
github.com/decred/dcrd/lru v1.1.2 // indirect
github.com/decred/dcrd/math/uint256 v1.0.1 // indirect
github.com/decred/dcrd/mixing v0.4.1 // indirect
github.com/decred/dcrd/peer/v3 v3.0.2 // indirect
github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0 // indirect
github.com/decred/dcrd/rpcclient/v8 v8.0.1 // indirect
github.com/decred/dcrd/txscript/v4 v4.1.1 // indirect
github.com/decred/dcrtest/dcrdtest v1.0.1-0.20240514160637-ade8c37ad1db // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.4 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/decred/dcrd/dcrjson/v4 v4.2.0 // indirect
github.com/decred/dcrd/gcs/v4 v4.1.1 // indirect
github.com/decred/dcrd/hdkeychain/v3 v3.1.3 // indirect
github.com/decred/dcrd/math/uint256 v1.0.2 // indirect
github.com/decred/dcrd/mixing v0.6.0 // indirect
github.com/decred/dcrd/peer/v3 v3.2.0 // indirect
github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.4.0 // indirect
github.com/decred/dcrd/rpcclient/v8 v8.1.0 // indirect
github.com/decred/dcrd/txscript/v4 v4.1.2 // indirect
github.com/decred/dcrtest/dcrdtest v1.0.1-0.20251125155744-84fc45da4d58 // indirect
github.com/decred/go-socks v1.1.0 // indirect
github.com/decred/lightning-onion/v4 v4.0.1 // indirect
github.com/decred/lightning-onion/v4 v4.0.2-0.20251215192853-9ddf49d1f20d // indirect
github.com/decred/vspd/client/v4 v4.0.2 // indirect
github.com/decred/vspd/types/v3 v3.0.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fergusstrange/embedded-postgres v1.25.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-macaroon-bakery/macaroonpb v1.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
Expand All @@ -86,7 +90,7 @@ require (
github.com/jackc/pgx/v4 v4.18.1 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/jrick/bitset v1.0.0 // indirect
github.com/jrick/wsrpc/v2 v2.3.5 // indirect
github.com/jrick/wsrpc/v2 v2.3.8 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/lib/pq v1.10.4 // indirect
Expand All @@ -100,44 +104,45 @@ require (
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/stretchr/testify v1.10.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.etcd.io/bbolt v1.3.12 // indirect
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/v2 v2.305.7 // indirect
go.etcd.io/etcd/client/v3 v3.5.7 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.7 // indirect
go.etcd.io/etcd/raft/v3 v3.5.7 // indirect
go.etcd.io/etcd/server/v3 v3.5.7 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.25.0 // indirect
go.opentelemetry.io/otel v1.0.1 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.1 // indirect
go.opentelemetry.io/otel/sdk v1.0.1 // indirect
go.opentelemetry.io/otel/trace v1.0.1 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.opentelemetry.io/proto/otlp v0.15.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/tools v0.39.0 // indirect
google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/errgo.v1 v1.0.1 // indirect
gopkg.in/macaroon-bakery.v2 v2.3.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
Expand Down
Loading
Loading