multi: fix linter issues

pull/496/head
sputn1ck 2 years ago
parent f0bf9302cc
commit a1271fee40
No known key found for this signature in database
GPG Key ID: 671103D881A5F0E4

@ -476,7 +476,6 @@ func setParams(ctx *cli.Context) error {
// so that it does not need to be manually updated. // so that it does not need to be manually updated.
case categoriesSet: case categoriesSet:
params.FeePpm = 0 params.FeePpm = 0
} }
// Update our parameters to our mutated values. // Update our parameters to our mutated values.
_, err = client.SetLiquidityParams( _, err = client.SetLiquidityParams(

@ -161,7 +161,7 @@ func loopOut(ctx *cli.Context) error {
} }
// Show a warning if a slow swap was requested. // Show a warning if a slow swap was requested.
warning := "" var warning string
if fast { if fast {
warning = "Fast swap requested." warning = "Fast swap requested."
} else { } else {

@ -49,7 +49,6 @@ func listAuth(ctx *cli.Context) error {
tokens := make([]*printableToken, len(resp.Tokens)) tokens := make([]*printableToken, len(resp.Tokens))
for i, t := range resp.Tokens { for i, t := range resp.Tokens {
mac := &macaroon.Macaroon{} mac := &macaroon.Macaroon{}
err := mac.UnmarshalBinary(t.BaseMacaroon) err := mac.UnmarshalBinary(t.BaseMacaroon)
if err != nil { if err != nil {

@ -60,7 +60,7 @@ func swapInfo(ctx *cli.Context) error {
id = ctx.String("id") id = ctx.String("id")
case ctx.NArg() > 0: case ctx.NArg() > 0:
id = args[0] id = args[0]
args = args.Tail() args = args.Tail() // nolint:wastedassign
default: default:
// Show command help if no arguments and flags were provided. // Show command help if no arguments and flags were provided.
return cli.ShowCommandHelp(ctx, "swapinfo") return cli.ShowCommandHelp(ctx, "swapinfo")

@ -305,7 +305,7 @@ type LoopInSwapInfo struct { // nolint
// LoopOutSwapInfo contains essential information of a loop-out swap after the // LoopOutSwapInfo contains essential information of a loop-out swap after the
// swap is initiated. // swap is initiated.
type LoopOutSwapInfo struct { // nolint:golint type LoopOutSwapInfo struct { // nolint:revive
// SwapHash contains the sha256 hash of the swap preimage. // SwapHash contains the sha256 hash of the swap preimage.
SwapHash lntypes.Hash SwapHash lntypes.Hash

@ -262,7 +262,6 @@ func (p Parameters) String() string {
ruleList = append( ruleList = append(
ruleList, fmt.Sprintf("Peer: %v: %v", peer, rule), ruleList, fmt.Sprintf("Peer: %v: %v", peer, rule),
) )
} }
return fmt.Sprintf("rules: %v, failure backoff: %v, sweep "+ return fmt.Sprintf("rules: %v, failure backoff: %v, sweep "+

@ -1409,7 +1409,6 @@ func TestSizeRestrictions(t *testing.T) {
Maximum: 6000, Maximum: 6000,
}, nil, }, nil,
).Once() ).Once()
}, },
suggestions: nil, suggestions: nil,
expectedError: ErrMaxExceedsServer, expectedError: ErrMaxExceedsServer,
@ -1582,7 +1581,6 @@ func TestFeePercentage(t *testing.T) {
error) { error) {
return testCase.quote, nil return testCase.quote, nil
} }
lnd.Channels = []lndclient.ChannelInfo{ lnd.Channels = []lndclient.ChannelInfo{

@ -152,7 +152,6 @@ func calculateSwapAmount(targetAmount, reserveAmount,
// cannot take any further action. // cannot take any further action.
case reserveAmount <= reserveMinimum: case reserveAmount <= reserveMinimum:
return 0 return 0
} }
// Express our minimum reserve amount as a maximum target amount. // Express our minimum reserve amount as a maximum target amount.

@ -103,6 +103,7 @@ func NewListenerConfig(config *Config, rpcCfg RPCConfig) *ListenerCfg {
if rpcCfg.LndConn != nil { if rpcCfg.LndConn != nil {
svcCfg.Dialer = func(context.Context, string) ( svcCfg.Dialer = func(context.Context, string) (
net.Conn, error) { net.Conn, error) {
return rpcCfg.LndConn, nil return rpcCfg.LndConn, nil
} }
} }

@ -936,7 +936,6 @@ func rpcToRule(rule *clientrpc.LiquidityRule) (*liquidity.SwapRule, error) {
default: default:
return nil, fmt.Errorf("unknown rule: %T", rule) return nil, fmt.Errorf("unknown rule: %T", rule)
} }
} }
// SuggestSwaps provides a list of suggested swaps based on lnd's current // SuggestSwaps provides a list of suggested swaps based on lnd's current

@ -19,7 +19,7 @@ import (
// "human-readable": Hex("102030"), // "human-readable": Hex("102030"),
// Hex("1111"): Hex("5783492373"), // Hex("1111"): Hex("5783492373"),
// }, // },
// } // } .
func DumpDB(tx *bbolt.Tx) error { // nolint: unused func DumpDB(tx *bbolt.Tx) error { // nolint: unused
return tx.ForEach(func(k []byte, bucket *bbolt.Bucket) error { return tx.ForEach(func(k []byte, bucket *bbolt.Bucket) error {
key := toString(k) key := toString(k)
@ -95,9 +95,7 @@ func restoreDB(bucket *bbolt.Bucket, data map[string]interface{}) error {
} }
continue continue
} }
switch value := v.(type) { switch value := v.(type) {
// Key contains value. // Key contains value.
case string: case string:
err := bucket.Put(key, []byte(value)) err := bucket.Put(key, []byte(value))

@ -90,7 +90,6 @@ func TestLoopOutStore(t *testing.T) {
t.Run("labelled swap", func(t *testing.T) { t.Run("labelled swap", func(t *testing.T) {
testLoopOutStore(t, &labelledSwap) testLoopOutStore(t, &labelledSwap)
}) })
} }
// testLoopOutStore tests the basic functionality of the current bbolt // testLoopOutStore tests the basic functionality of the current bbolt

@ -257,7 +257,6 @@ func testLoopInTimeout(t *testing.T,
// Expect a signing request for the htlc tx output value. // Expect a signing request for the htlc tx output value.
signReq := <-ctx.lnd.SignOutputRawChannel signReq := <-ctx.lnd.SignOutputRawChannel
if signReq.SignDescriptors[0].Output.Value != htlcTx.TxOut[0].Value { if signReq.SignDescriptors[0].Output.Value != htlcTx.TxOut[0].Value {
t.Fatal("invalid signing amount") t.Fatal("invalid signing amount")
} }

@ -114,6 +114,7 @@ func TestLoopOutPaymentParameters(t *testing.T) {
if !reflect.DeepEqual( if !reflect.DeepEqual(
[]uint64(req.OutgoingChanSet), swapPayment.OutgoingChanIds, []uint64(req.OutgoingChanSet), swapPayment.OutgoingChanIds,
) { ) {
t.Fatalf("Unexpected outgoing channel set") t.Fatalf("Unexpected outgoing channel set")
} }

@ -503,7 +503,7 @@ type HtlcScriptV2 struct {
// OP_ELSE // OP_ELSE
// OP_SIZE <20> OP_EQUALVERIFY OP_HASH160 <ripemd(swapHash)> OP_EQUALVERIFY 1 // OP_SIZE <20> OP_EQUALVERIFY OP_HASH160 <ripemd(swapHash)> OP_EQUALVERIFY 1
// OP_CHECKSEQUENCEVERIFY // OP_CHECKSEQUENCEVERIFY
// OP_ENDIF // OP_ENDIF .
func newHTLCScriptV2(cltvExpiry int32, senderHtlcKey, func newHTLCScriptV2(cltvExpiry int32, senderHtlcKey,
receiverHtlcKey [33]byte, swapHash lntypes.Hash) (*HtlcScriptV2, error) { receiverHtlcKey [33]byte, swapHash lntypes.Hash) (*HtlcScriptV2, error) {

@ -26,7 +26,7 @@ import (
// asserting the result matches the validity expectation. In the case where it // asserting the result matches the validity expectation. In the case where it
// doesn't match the expectation, it executes the script step-by-step and // doesn't match the expectation, it executes the script step-by-step and
// prints debug information to stdout. // prints debug information to stdout.
// This code is adopted from: lnd/input/script_utils_test.go // This code is adopted from: lnd/input/script_utils_test.go .
func assertEngineExecution(t *testing.T, valid bool, func assertEngineExecution(t *testing.T, valid bool,
newEngine func() (*txscript.Engine, error)) { newEngine func() (*txscript.Engine, error)) {
@ -200,7 +200,6 @@ func TestHtlcV2(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
return witness return witness
}, true, }, true,
}, },
{ {

@ -41,7 +41,6 @@ func (s *PrefixLog) Errorf(format string, params ...interface{}) {
fmt.Sprintf("%v %s", ShortHash(&s.Hash), format), fmt.Sprintf("%v %s", ShortHash(&s.Hash), format),
params..., params...,
) )
} }
// ShortHash returns a shortened version of the hash suitable for use in // ShortHash returns a shortened version of the hash suitable for use in

@ -185,7 +185,7 @@ func (h *mockLightningClient) ListTransactions(
} }
// GetNodeInfo retrieves info on the node, and if includeChannels is True, // GetNodeInfo retrieves info on the node, and if includeChannels is True,
// will return other channels the node may have with other peers // will return other channels the node may have with other peers.
func (h *mockLightningClient) GetNodeInfo(ctx context.Context, func (h *mockLightningClient) GetNodeInfo(ctx context.Context,
pubKeyBytes route.Vertex, includeChannels bool) (*lndclient.NodeInfo, error) { pubKeyBytes route.Vertex, includeChannels bool) (*lndclient.NodeInfo, error) {
@ -224,7 +224,7 @@ func (h *mockLightningClient) GetNodeInfo(ctx context.Context,
return nodeInfo, nil return nodeInfo, nil
} }
// GetChanInfo retrieves all the info the node has on the given channel // GetChanInfo retrieves all the info the node has on the given channel.
func (h *mockLightningClient) GetChanInfo(ctx context.Context, func (h *mockLightningClient) GetChanInfo(ctx context.Context,
channelID uint64) (*lndclient.ChannelEdge, error) { channelID uint64) (*lndclient.ChannelEdge, error) {

Loading…
Cancel
Save