mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
lint: enable deprecation checks
Enable staticcheck's SA1019 check in golangci-lint so deprecated identifiers are caught in CI. Replace deprecated standard library and bbolt APIs with their current equivalents. Keep intentional compatibility reads and writes of deprecated Loop RPC fields behind narrow nolint annotations, because older clients and persisted liquidity parameters still depend on those fields.
This commit is contained in:
parent
d324b4bfd8
commit
5d8a5019cf
12 changed files with 42 additions and 52 deletions
|
|
@ -33,7 +33,7 @@ import (
|
|||
"github.com/lightningnetwork/lnd/clock"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/macaroons"
|
||||
"go.etcd.io/bbolt"
|
||||
bbolterrors "go.etcd.io/bbolt/errors"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"gopkg.in/macaroon-bakery.v2/bakery"
|
||||
|
|
@ -161,7 +161,7 @@ func (d *Daemon) Start() error {
|
|||
// and error handlers. If this fails, then nothing has been started yet,
|
||||
// and we can just return the error.
|
||||
err = d.initialize(true)
|
||||
if errors.Is(err, bbolt.ErrTimeout) {
|
||||
if errors.Is(err, bbolterrors.ErrTimeout) {
|
||||
// We're trying to be started as a standalone Loop daemon, most
|
||||
// likely LiT is already running and blocking the DB
|
||||
return fmt.Errorf("%v: make sure no other loop daemon process "+
|
||||
|
|
@ -211,7 +211,7 @@ func (d *Daemon) StartAsSubserver(lndGrpc *lndclient.GrpcLndServices,
|
|||
// handlers. If this fails, then nothing has been started yet, and we
|
||||
// can just return the error.
|
||||
err := d.initialize(withMacaroonService)
|
||||
if errors.Is(err, bbolt.ErrTimeout) {
|
||||
if errors.Is(err, bbolterrors.ErrTimeout) {
|
||||
// We're trying to be started inside LiT so there most likely is
|
||||
// another standalone Loop process blocking the DB.
|
||||
return fmt.Errorf("%v: make sure no other loop daemon "+
|
||||
|
|
@ -994,7 +994,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
|
|||
d.wg.Go(func() {
|
||||
infof("Starting static address open channel manager")
|
||||
err := openChannelManager.Run(d.mainCtx)
|
||||
if err != nil && !errors.Is(context.Canceled, err) {
|
||||
if err != nil && !errors.Is(err, context.Canceled) {
|
||||
d.internalErrChan <- err
|
||||
}
|
||||
infof("Static address open channel manager stopped")
|
||||
|
|
|
|||
|
|
@ -251,6 +251,7 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
|
|||
req.AssetSwapRfqId = in.AssetRfqInfo.SwapRfqId
|
||||
}
|
||||
|
||||
// Keep accepting the deprecated single-channel field for older clients.
|
||||
switch {
|
||||
case in.LoopOutChannel != 0 && len(in.OutgoingChanSet) > 0: // nolint:staticcheck
|
||||
return nil, errors.New("loop_out_channel and outgoing_" +
|
||||
|
|
@ -273,7 +274,7 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
|
|||
resp := &looprpc.SwapResponse{
|
||||
Id: info.SwapHash.String(),
|
||||
IdBytes: info.SwapHash[:],
|
||||
HtlcAddress: htlcAddress,
|
||||
HtlcAddress: htlcAddress, //nolint:staticcheck
|
||||
ServerMessage: info.ServerMessage,
|
||||
}
|
||||
|
||||
|
|
@ -1182,11 +1183,11 @@ func (s *swapClientServer) LoopIn(ctx context.Context,
|
|||
|
||||
if loopdb.CurrentProtocolVersion() < loopdb.ProtocolVersionHtlcV3 {
|
||||
p2wshAddr := swapInfo.HtlcAddressP2WSH.String()
|
||||
response.HtlcAddress = p2wshAddr
|
||||
response.HtlcAddress = p2wshAddr //nolint:staticcheck
|
||||
response.HtlcAddressP2Wsh = p2wshAddr
|
||||
} else {
|
||||
p2trAddr := swapInfo.HtlcAddressP2TR.String()
|
||||
response.HtlcAddress = p2trAddr
|
||||
response.HtlcAddress = p2trAddr //nolint:staticcheck
|
||||
response.HtlcAddressP2Tr = p2trAddr
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue