mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 14:17:56 +01:00
invoices: remove the global mock htlcModifierMock
This can create race in the tests.
This commit is contained in:
@@ -24,12 +24,6 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
// htlcModifierMock is a mock implementation of the invoice HtlcModifier
|
|
||||||
// interface.
|
|
||||||
htlcModifierMock = &invpkg.MockHtlcModifier{}
|
|
||||||
)
|
|
||||||
|
|
||||||
// TestInvoiceRegistry is a master test which encompasses all tests using an
|
// TestInvoiceRegistry is a master test which encompasses all tests using an
|
||||||
// InvoiceDB instance. The purpose of this test is to be able to run all tests
|
// InvoiceDB instance. The purpose of this test is to be able to run all tests
|
||||||
// with a custom DB instance, so that we can test the same logic with different
|
// with a custom DB instance, so that we can test the same logic with different
|
||||||
@@ -541,7 +535,7 @@ func testSettleHoldInvoice(t *testing.T,
|
|||||||
cfg := invpkg.RegistryConfig{
|
cfg := invpkg.RegistryConfig{
|
||||||
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
||||||
Clock: clock,
|
Clock: clock,
|
||||||
HtlcInterceptor: htlcModifierMock,
|
HtlcInterceptor: &invpkg.MockHtlcModifier{},
|
||||||
}
|
}
|
||||||
|
|
||||||
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
||||||
@@ -711,7 +705,7 @@ func testCancelHoldInvoice(t *testing.T,
|
|||||||
cfg := invpkg.RegistryConfig{
|
cfg := invpkg.RegistryConfig{
|
||||||
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
||||||
Clock: testClock,
|
Clock: testClock,
|
||||||
HtlcInterceptor: htlcModifierMock,
|
HtlcInterceptor: &invpkg.MockHtlcModifier{},
|
||||||
}
|
}
|
||||||
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
||||||
cfg.Clock, 0, uint32(testCurrentHeight), nil, newMockNotifier(),
|
cfg.Clock, 0, uint32(testCurrentHeight), nil, newMockNotifier(),
|
||||||
@@ -1231,7 +1225,7 @@ func testInvoiceExpiryWithRegistry(t *testing.T,
|
|||||||
cfg := invpkg.RegistryConfig{
|
cfg := invpkg.RegistryConfig{
|
||||||
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
||||||
Clock: testClock,
|
Clock: testClock,
|
||||||
HtlcInterceptor: htlcModifierMock,
|
HtlcInterceptor: &invpkg.MockHtlcModifier{},
|
||||||
}
|
}
|
||||||
|
|
||||||
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
||||||
@@ -1342,7 +1336,7 @@ func testOldInvoiceRemovalOnStart(t *testing.T,
|
|||||||
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
FinalCltvRejectDelta: testFinalCltvRejectDelta,
|
||||||
Clock: testClock,
|
Clock: testClock,
|
||||||
GcCanceledInvoicesOnStartup: true,
|
GcCanceledInvoicesOnStartup: true,
|
||||||
HtlcInterceptor: htlcModifierMock,
|
HtlcInterceptor: &invpkg.MockHtlcModifier{},
|
||||||
}
|
}
|
||||||
|
|
||||||
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
expiryWatcher := invpkg.NewInvoiceExpiryWatcher(
|
||||||
|
|||||||
Reference in New Issue
Block a user