diff --git a/routing/notifications_test.go b/routing/notifications_test.go index 05d859a7..47efe342 100644 --- a/routing/notifications_test.go +++ b/routing/notifications_test.go @@ -212,6 +212,8 @@ type mockChainView struct { newBlocks chan *chainview.FilteredBlock staleBlocks chan *chainview.FilteredBlock + chain lnwallet.BlockChainIO + filter map[wire.OutPoint]struct{} quit chan struct{} @@ -221,8 +223,9 @@ type mockChainView struct { // chainview.FilteredChainView. var _ chainview.FilteredChainView = (*mockChainView)(nil) -func newMockChainView() *mockChainView { +func newMockChainView(chain lnwallet.BlockChainIO) *mockChainView { return &mockChainView{ + chain: chain, newBlocks: make(chan *chainview.FilteredBlock, 10), staleBlocks: make(chan *chainview.FilteredBlock, 10), filter: make(map[wire.OutPoint]struct{}), @@ -230,6 +233,13 @@ func newMockChainView() *mockChainView { } } +func (m *mockChainView) Reset() { + m.filter = make(map[wire.OutPoint]struct{}) + m.quit = make(chan struct{}) + m.newBlocks = make(chan *chainview.FilteredBlock, 10) + m.staleBlocks = make(chan *chainview.FilteredBlock, 10) +} + func (m *mockChainView) UpdateFilter(ops []wire.OutPoint, updateHeight uint32) error { m.Lock() defer m.Unlock() @@ -316,6 +326,7 @@ func (m *mockChainView) Start() error { } func (m *mockChainView) Stop() error { + close(m.quit) return nil }