mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 17:51:33 +02:00
multi: move many t.Fatalf calls to require.NoError
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// invoiceExpiryWatcherTest holds a test fixture and implements checks
|
||||
@@ -72,9 +73,7 @@ func newInvoiceExpiryWatcherTest(t *testing.T, now time.Time,
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("cannot start InvoiceExpiryWatcher: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "cannot start InvoiceExpiryWatcher")
|
||||
|
||||
return test
|
||||
}
|
||||
|
@@ -132,9 +132,7 @@ func TestSettleInvoice(t *testing.T) {
|
||||
testInvoicePaymentHash, amtPaid, testHtlcExpiry, testCurrentHeight,
|
||||
getCircuitKey(0), hodlChan, testPayload,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected NotifyExitHopHtlc error: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "unexpected NotifyExitHopHtlc error")
|
||||
require.NotNil(t, resolution)
|
||||
settleResolution = checkSettleResolution(
|
||||
t, resolution, testInvoicePreimage,
|
||||
@@ -148,9 +146,7 @@ func TestSettleInvoice(t *testing.T) {
|
||||
testInvoicePaymentHash, amtPaid+600, testHtlcExpiry, testCurrentHeight,
|
||||
getCircuitKey(1), hodlChan, testPayload,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected NotifyExitHopHtlc error: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "unexpected NotifyExitHopHtlc error")
|
||||
require.NotNil(t, resolution)
|
||||
settleResolution = checkSettleResolution(
|
||||
t, resolution, testInvoicePreimage,
|
||||
@@ -163,9 +159,7 @@ func TestSettleInvoice(t *testing.T) {
|
||||
testInvoicePaymentHash, amtPaid-600, testHtlcExpiry, testCurrentHeight,
|
||||
getCircuitKey(2), hodlChan, testPayload,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected NotifyExitHopHtlc error: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "unexpected NotifyExitHopHtlc error")
|
||||
require.NotNil(t, resolution)
|
||||
checkFailResolution(t, resolution, ResultAmountTooLow)
|
||||
|
||||
|
@@ -272,15 +272,11 @@ func newTestInvoice(t *testing.T, preimage lntypes.Preimage,
|
||||
zpay32.Expiry(expiry),
|
||||
zpay32.PaymentAddr(payAddr),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Error while creating new invoice: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "Error while creating new invoice")
|
||||
|
||||
paymentRequest, err := rawInvoice.Encode(testMessageSigner)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Error while encoding payment request: %v", err)
|
||||
}
|
||||
require.NoError(t, err, "Error while encoding payment request")
|
||||
|
||||
return &channeldb.Invoice{
|
||||
Terms: channeldb.ContractTerm{
|
||||
|
Reference in New Issue
Block a user