From dd149471542fed7a60b8b0088968a13c811bc1a1 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Fri, 30 Apr 2021 12:35:53 +0200 Subject: [PATCH] lint: silence depreciation warnings --- cmd/lncli/cmd_open_channel.go | 2 +- lntest/itest/lnd_amp_test.go | 4 +-- lntest/itest/lnd_funding_test.go | 2 +- ..._force_close_on_chain_htlc_timeout_test.go | 2 +- lntest/itest/lnd_single_hop_invoice_test.go | 2 +- lntest/itest/lnd_test.go | 26 +++++++++---------- rpcserver.go | 14 +++++----- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/cmd/lncli/cmd_open_channel.go b/cmd/lncli/cmd_open_channel.go index 3ee9876f..a2c1a530 100644 --- a/cmd/lncli/cmd_open_channel.go +++ b/cmd/lncli/cmd_open_channel.go @@ -744,7 +744,7 @@ func checkPsbtFlags(req *lnrpc.OpenChannelRequest) error { return fmt.Errorf("specifying minimum confirmations for PSBT " + "funding is not supported") } - if req.TargetConf != 0 || req.SatPerByte != 0 || req.SatPerVbyte != 0 { + if req.TargetConf != 0 || req.SatPerByte != 0 || req.SatPerVbyte != 0 { // nolint:staticcheck return fmt.Errorf("setting fee estimation parameters not " + "supported for PSBT funding") } diff --git a/lntest/itest/lnd_amp_test.go b/lntest/itest/lnd_amp_test.go index 74392351..66308bb0 100644 --- a/lntest/itest/lnd_amp_test.go +++ b/lntest/itest/lnd_amp_test.go @@ -108,7 +108,7 @@ func testSendPaymentAMP(net *lntest.NetworkHarness, t *harnessTest) { // Assert that the invoice is settled for the total payment amount and // has the correct payment address. - require.True(t.t, rpcInvoice.Settled) + require.True(t.t, rpcInvoice.Settled) // nolint:staticcheck require.Equal(t.t, lnrpc.Invoice_SETTLED, rpcInvoice.State) require.Equal(t.t, int64(paymentAmt), rpcInvoice.AmtPaidSat) require.Equal(t.t, int64(paymentAmt*1000), rpcInvoice.AmtPaidMsat) @@ -294,7 +294,7 @@ func testSendToRouteAMP(net *lntest.NetworkHarness, t *harnessTest) { // Assert that the invoice is settled for the total payment amount and // has the correct payment address. - require.True(t.t, rpcInvoice.Settled) + require.True(t.t, rpcInvoice.Settled) // nolint:staticcheck require.Equal(t.t, lnrpc.Invoice_SETTLED, rpcInvoice.State) require.Equal(t.t, int64(paymentAmt), rpcInvoice.AmtPaidSat) require.Equal(t.t, int64(paymentAmt*1000), rpcInvoice.AmtPaidMsat) diff --git a/lntest/itest/lnd_funding_test.go b/lntest/itest/lnd_funding_test.go index b957205f..dd19a597 100644 --- a/lntest/itest/lnd_funding_test.go +++ b/lntest/itest/lnd_funding_test.go @@ -188,7 +188,7 @@ func basicChannelFundingTest(t *harnessTest, net *lntest.NetworkHarness, lnwire.NewMSatFromSatoshis(remote), ) // Deprecated fields. - newResp.Balance += int64(local) + newResp.Balance += int64(local) // nolint:staticcheck assertChannelBalanceResp(t, node, newResp) } diff --git a/lntest/itest/lnd_multi-hop_remote_force_close_on_chain_htlc_timeout_test.go b/lntest/itest/lnd_multi-hop_remote_force_close_on_chain_htlc_timeout_test.go index b8dee822..68547328 100644 --- a/lntest/itest/lnd_multi-hop_remote_force_close_on_chain_htlc_timeout_test.go +++ b/lntest/itest/lnd_multi-hop_remote_force_close_on_chain_htlc_timeout_test.go @@ -220,7 +220,7 @@ func assertOnChainInvoiceState(ctx context.Context, t *harnessTest, }) require.NoError(t.t, err) - require.True(t.t, inv.Settled, "expected erroneously settled invoice") + require.True(t.t, inv.Settled, "expected erroneously settled invoice") // nolint:staticcheck for _, htlc := range inv.Htlcs { require.Equal(t.t, lnrpc.InvoiceHTLCState_SETTLED, htlc.State, "expected htlcs to be erroneously settled") diff --git a/lntest/itest/lnd_single_hop_invoice_test.go b/lntest/itest/lnd_single_hop_invoice_test.go index e93f9362..d0ed525b 100644 --- a/lntest/itest/lnd_single_hop_invoice_test.go +++ b/lntest/itest/lnd_single_hop_invoice_test.go @@ -86,7 +86,7 @@ func testSingleHopInvoice(net *lntest.NetworkHarness, t *harnessTest) { if err != nil { t.Fatalf("unable to lookup invoice: %v", err) } - if !dbInvoice.Settled { + if !dbInvoice.Settled { // nolint:staticcheck t.Fatalf("bob's invoice should be marked as settled: %v", spew.Sdump(dbInvoice)) } diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index ecb487e1..d3a86d4f 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -5642,7 +5642,7 @@ func testSingleHopSendToRouteCase(net *lntest.NetworkHarness, t *harnessTest, } sendToRouteStream := func() { ctxt, _ = context.WithTimeout(ctxb, defaultTimeout) - alicePayStream, err := carol.SendToRoute(ctxt) + alicePayStream, err := carol.SendToRoute(ctxt) // nolint:staticcheck if err != nil { t.Fatalf("unable to create payment stream for "+ "carol: %v", err) @@ -12672,20 +12672,20 @@ func testQueryRoutes(net *lntest.NetworkHarness, t *harnessTest) { lnwire.MilliSatoshi(len(route.Hops)-1) * feePerHopMSat expectedTotalAmtMSat := (paymentAmt * mSat) + expectedTotalFeesMSat - if route.TotalFees != route.TotalFeesMsat/mSat { + if route.TotalFees != route.TotalFeesMsat/mSat { // nolint:staticcheck t.Fatalf("route %v: total fees %v (msat) does not "+ "round down to %v (sat)", - i, route.TotalFeesMsat, route.TotalFees) + i, route.TotalFeesMsat, route.TotalFees) // nolint:staticcheck } if route.TotalFeesMsat != int64(expectedTotalFeesMSat) { t.Fatalf("route %v: total fees in msat expected %v got %v", i, expectedTotalFeesMSat, route.TotalFeesMsat) } - if route.TotalAmt != route.TotalAmtMsat/mSat { + if route.TotalAmt != route.TotalAmtMsat/mSat { // nolint:staticcheck t.Fatalf("route %v: total amt %v (msat) does not "+ "round down to %v (sat)", - i, route.TotalAmtMsat, route.TotalAmt) + i, route.TotalAmtMsat, route.TotalAmt) // nolint:staticcheck } if route.TotalAmtMsat != int64(expectedTotalAmtMSat) { t.Fatalf("route %v: total amt in msat expected %v got %v", @@ -12698,20 +12698,20 @@ func testQueryRoutes(net *lntest.NetworkHarness, t *harnessTest) { for j, hop := range route.Hops[:len(route.Hops)-1] { expectedAmtToForwardMSat -= feePerHopMSat - if hop.Fee != hop.FeeMsat/mSat { + if hop.Fee != hop.FeeMsat/mSat { // nolint:staticcheck t.Fatalf("route %v hop %v: fee %v (msat) does not "+ "round down to %v (sat)", - i, j, hop.FeeMsat, hop.Fee) + i, j, hop.FeeMsat, hop.Fee) // nolint:staticcheck } if hop.FeeMsat != int64(feePerHopMSat) { t.Fatalf("route %v hop %v: fee in msat expected %v got %v", i, j, feePerHopMSat, hop.FeeMsat) } - if hop.AmtToForward != hop.AmtToForwardMsat/mSat { + if hop.AmtToForward != hop.AmtToForwardMsat/mSat { // nolint:staticcheck t.Fatalf("route %v hop %v: amt to forward %v (msat) does not "+ "round down to %v (sat)", - i, j, hop.AmtToForwardMsat, hop.AmtToForward) + i, j, hop.AmtToForwardMsat, hop.AmtToForward) // nolint:staticcheck } if hop.AmtToForwardMsat != int64(expectedAmtToForwardMSat) { t.Fatalf("route %v hop %v: amt to forward in msat "+ @@ -12723,15 +12723,15 @@ func testQueryRoutes(net *lntest.NetworkHarness, t *harnessTest) { // payment amount. hop := route.Hops[len(route.Hops)-1] - if hop.Fee != 0 || hop.FeeMsat != 0 { + if hop.Fee != 0 || hop.FeeMsat != 0 { // nolint:staticcheck t.Fatalf("route %v hop %v: fee expected 0 got %v (sat) %v (msat)", - i, len(route.Hops)-1, hop.Fee, hop.FeeMsat) + i, len(route.Hops)-1, hop.Fee, hop.FeeMsat) // nolint:staticcheck } - if hop.AmtToForward != hop.AmtToForwardMsat/mSat { + if hop.AmtToForward != hop.AmtToForwardMsat/mSat { // nolint:staticcheck t.Fatalf("route %v hop %v: amt to forward %v (msat) does not "+ "round down to %v (sat)", - i, len(route.Hops)-1, hop.AmtToForwardMsat, hop.AmtToForward) + i, len(route.Hops)-1, hop.AmtToForwardMsat, hop.AmtToForward) // nolint:staticcheck } if hop.AmtToForwardMsat != paymentAmt*mSat { t.Fatalf("route %v hop %v: amt to forward in msat "+ diff --git a/rpcserver.go b/rpcserver.go index a8aefdac..1bb95aa0 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1122,7 +1122,7 @@ func (r *rpcServer) SendCoins(ctx context.Context, // Calculate an appropriate fee rate for this transaction. feePerKw, err := calculateFeeRate( - uint64(in.SatPerByte), in.SatPerVbyte, + uint64(in.SatPerByte), in.SatPerVbyte, // nolint:staticcheck uint32(in.TargetConf), r.server.cc.FeeEstimator, ) if err != nil { @@ -1330,7 +1330,7 @@ func (r *rpcServer) SendMany(ctx context.Context, // Calculate an appropriate fee rate for this transaction. feePerKw, err := calculateFeeRate( - uint64(in.SatPerByte), in.SatPerVbyte, + uint64(in.SatPerByte), in.SatPerVbyte, // nolint:staticcheck uint32(in.TargetConf), r.server.cc.FeeEstimator, ) if err != nil { @@ -1731,7 +1731,7 @@ func newPsbtAssembler(req *lnrpc.OpenChannelRequest, normalizedMinConfs int32, "minimum confirmation is not supported for PSBT " + "funding") } - if req.SatPerByte != 0 || req.SatPerVbyte != 0 || req.TargetConf != 0 { + if req.SatPerByte != 0 || req.SatPerVbyte != 0 || req.TargetConf != 0 { // nolint:staticcheck return nil, fmt.Errorf("specifying fee estimation parameters " + "is not supported for PSBT funding") } @@ -1862,7 +1862,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest, // key object. For all sync call, byte slices are expected to be encoded // as hex strings. case isSync: - keyBytes, err := hex.DecodeString(in.NodePubkeyString) + keyBytes, err := hex.DecodeString(in.NodePubkeyString) // nolint:staticcheck if err != nil { return nil, err } @@ -1884,7 +1884,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest, // Calculate an appropriate fee rate for this transaction. feeRate, err := calculateFeeRate( - uint64(in.SatPerByte), in.SatPerVbyte, + uint64(in.SatPerByte), in.SatPerVbyte, // nolint:staticcheck uint32(in.TargetConf), r.server.cc.FeeEstimator, ) if err != nil { @@ -2087,7 +2087,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest, // If force closing a channel, the fee set in the commitment transaction // is used. - if in.Force && (in.SatPerByte != 0 || in.SatPerVbyte != 0 || + if in.Force && (in.SatPerByte != 0 || in.SatPerVbyte != 0 || // nolint:staticcheck in.TargetConf != 0) { return fmt.Errorf("force closing a channel uses a pre-defined fee") @@ -2222,7 +2222,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest, // an appropriate fee rate for the cooperative closure // transaction. feeRate, err := calculateFeeRate( - uint64(in.SatPerByte), in.SatPerVbyte, + uint64(in.SatPerByte), in.SatPerVbyte, // nolint:staticcheck uint32(in.TargetConf), r.server.cc.FeeEstimator, ) if err != nil {