itest: fix make lint

This commit is contained in:
yyforyongyu 2021-06-29 05:10:16 +08:00
parent c912d1aae0
commit d28e67ddb0
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
6 changed files with 19 additions and 29 deletions

View File

@ -361,7 +361,7 @@ func assertChannelClosed(ctx context.Context, t *harnessTest,
// findForceClosedChannel searches a pending channel response for a particular
// channel, returning the force closed channel upon success.
func findForceClosedChannel(pendingChanResp *lnrpc.PendingChannelsResponse,
op *wire.OutPoint) (*lnrpc.PendingChannelsResponse_ForceClosedChannel,
op fmt.Stringer) (*lnrpc.PendingChannelsResponse_ForceClosedChannel,
error) {
for _, forceClose := range pendingChanResp.PendingForceClosingChannels {
@ -376,7 +376,7 @@ func findForceClosedChannel(pendingChanResp *lnrpc.PendingChannelsResponse,
// findWaitingCloseChannel searches a pending channel response for a particular
// channel, returning the waiting close channel upon success.
func findWaitingCloseChannel(pendingChanResp *lnrpc.PendingChannelsResponse,
op *wire.OutPoint) (*lnrpc.PendingChannelsResponse_WaitingCloseChannel,
op fmt.Stringer) (*lnrpc.PendingChannelsResponse_WaitingCloseChannel,
error) {
for _, waitingClose := range pendingChanResp.WaitingCloseChannels {
@ -1237,7 +1237,7 @@ func assertNumPendingChannels(t *harnessTest, node *lntest.HarnessNode,
}
n := len(pendingChanResp.WaitingCloseChannels)
if n != expWaitingClose {
predErr = fmt.Errorf("Expected to find %d channels "+
predErr = fmt.Errorf("expected to find %d channels "+
"waiting close, found %d", expWaitingClose, n)
return false
}

View File

@ -379,10 +379,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
var predErr error
err = wait.Predicate(func() bool {
predErr = assertNumActiveHtlcs(nodes, numInvoices)
if predErr != nil {
return false
}
return true
return predErr == nil
}, defaultTimeout)
if err != nil {
t.Fatalf("htlc mismatch: %v", predErr)
@ -1136,11 +1133,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
}
predErr = checkPendingChannelNumHtlcs(forceClose, numInvoices)
if predErr != nil {
return false
}
return true
return predErr == nil
}, defaultTimeout)
if err != nil {
t.Fatalf(predErr.Error())
@ -1473,7 +1466,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) {
}
n := len(pendingChanResp.WaitingCloseChannels)
if n != 1 {
predErr = fmt.Errorf("Expected to find %d channels "+
predErr = fmt.Errorf("expected to find %d channels "+
"waiting close, found %d", 1, n)
return false
}
@ -1503,7 +1496,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) {
}
n := len(pendingChanResp.WaitingCloseChannels)
if n != 0 {
predErr = fmt.Errorf("Expected to find %d channels "+
predErr = fmt.Errorf("expected to find %d channels "+
"waiting close, found %d", 0, n)
return false
}

View File

@ -235,14 +235,14 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
payAmt = btcutil.Amount(4)
amtSat := int64(payAmt)
amtMSat := int64(lnwire.NewMSatFromSatoshis(payAmt))
routes.Routes[0].Hops[0].AmtToForward = amtSat
routes.Routes[0].Hops[0].AmtToForward = amtSat // nolint:staticcheck
routes.Routes[0].Hops[0].AmtToForwardMsat = amtMSat
routes.Routes[0].Hops[1].AmtToForward = amtSat
routes.Routes[0].Hops[1].AmtToForward = amtSat // nolint:staticcheck
routes.Routes[0].Hops[1].AmtToForwardMsat = amtMSat
// Send the payment with the modified value.
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
alicePayStream, err := net.Alice.SendToRoute(ctxt)
alicePayStream, err := net.Alice.SendToRoute(ctxt) // nolint:staticcheck
if err != nil {
t.Fatalf("unable to create payment stream for alice: %v", err)
}
@ -279,9 +279,9 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
payAmt = btcutil.Amount(5)
amtSat = int64(payAmt)
amtMSat = int64(lnwire.NewMSatFromSatoshis(payAmt))
routes.Routes[0].Hops[0].AmtToForward = amtSat
routes.Routes[0].Hops[0].AmtToForward = amtSat // nolint:staticcheck
routes.Routes[0].Hops[0].AmtToForwardMsat = amtMSat
routes.Routes[0].Hops[1].AmtToForward = amtSat
routes.Routes[0].Hops[1].AmtToForward = amtSat // nolint:staticcheck
routes.Routes[0].Hops[1].AmtToForwardMsat = amtMSat
// Manually set the MPP payload a new for each payment since

View File

@ -304,7 +304,7 @@ func testSphinxReplayPersistence(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("dave's invoice should not be marked as settled: %v",
spew.Sdump(dbInvoice))
}

View File

@ -102,7 +102,7 @@ func testListPayments(net *lntest.NetworkHarness, t *harnessTest) {
t.Fatalf("incorrect number of payments, got %v, want %v",
len(paymentsResp.Payments), 1)
}
p := paymentsResp.Payments[0]
p := paymentsResp.Payments[0] // nolint:staticcheck
path := p.Htlcs[len(p.Htlcs)-1].Route.Hops
// Ensure that the stored path shows a direct payment to Bob with no
@ -112,9 +112,9 @@ func testListPayments(net *lntest.NetworkHarness, t *harnessTest) {
}
// The payment amount should also match our previous payment directly.
if p.Value != paymentAmt {
if p.Value != paymentAmt { // nolint:staticcheck
t.Fatalf("incorrect amount, got %v, want %v",
p.Value, paymentAmt)
p.Value, paymentAmt) // nolint:staticcheck
}
// The payment hash (or r-hash) should have been stored correctly.
@ -126,8 +126,8 @@ func testListPayments(net *lntest.NetworkHarness, t *harnessTest) {
// As we made a single-hop direct payment, there should have been no fee
// applied.
if p.Fee != 0 {
t.Fatalf("incorrect Fee, got %v, want %v", p.Fee, 0)
if p.Fee != 0 { // nolint:staticcheck
t.Fatalf("incorrect Fee, got %v, want %v", p.Fee, 0) // nolint:staticcheck
}
// Finally, verify that the payment request returned by the rpc matches

View File

@ -176,10 +176,7 @@ func testSwitchCircuitPersistence(net *lntest.NetworkHarness, t *harnessTest) {
var predErr error
err = wait.Predicate(func() bool {
predErr = assertNumActiveHtlcs(nodes, numPayments)
if predErr != nil {
return false
}
return true
return predErr == nil
}, defaultTimeout)
if err != nil {
t.Fatalf("htlc mismatch: %v", predErr)