Skip to content

Commit e6a55b4

Browse files
committed
htlcswitch+peer: add trivial implementations for flush api to mocks
1 parent 0ca384e commit e6a55b4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

htlcswitch/mock.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,11 @@ func (f *mockChannelLink) UpdateShortChanID() (lnwire.ShortChannelID, error) {
906906
return f.shortChanID, nil
907907
}
908908
func (f *mockChannelLink) Flush(onFlushed func()) error {
909-
return errors.New("mockChannelLink does not support flush api")
909+
onFlushed()
910+
return nil
910911
}
911912
func (f *mockChannelLink) CancelFlush() error {
912-
return errors.New("mockChannelLink does not support flush api")
913+
return errors.New("no flush in progress to cancel")
913914
}
914915
func (f *mockChannelLink) IsFlushing() bool {
915916
return false

peer/test_utils.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,13 @@ type mockMessageConn struct {
500500
curReadMessage []byte
501501
}
502502

503-
func (m *mockUpdateHandler) Flush(func()) error {
504-
return errors.New("mockUpdateHandler does not support flush api")
503+
func (m *mockUpdateHandler) Flush(onFlushed func()) error {
504+
onFlushed()
505+
return nil
505506
}
506507

507508
func (m *mockUpdateHandler) CancelFlush() error {
508-
return errors.New("mockUpdateHandler does not support flush api")
509+
return errors.New("no flush in progress to cancel")
509510
}
510511

511512
func (m *mockUpdateHandler) IsFlushing() bool {

0 commit comments

Comments
 (0)