loop: add cancel swap to server interface

This commit is contained in:
carla 2021-05-24 08:40:13 +02:00
parent 71501ef2e8
commit 969e300241
No known key found for this signature in database
GPG key ID: 4CA7FE54A6213C91
2 changed files with 115 additions and 0 deletions

View file

@ -43,6 +43,9 @@ type serverMock struct {
// preimagePush is a channel that preimage pushes are sent into.
preimagePush chan lntypes.Preimage
// cancelSwap is a channel that swap cancelations are sent into.
cancelSwap chan *outCancelDetails
lnd *test.LndMockServices
}
@ -59,6 +62,7 @@ func newServerMock(lnd *test.LndMockServices) *serverMock {
height: 600,
preimagePush: make(chan lntypes.Preimage),
cancelSwap: make(chan *outCancelDetails),
lnd: lnd,
}
@ -178,6 +182,14 @@ func (s *serverMock) PushLoopOutPreimage(_ context.Context,
return nil
}
// CancelLoopOutSwap pushes a request to cancel a swap into our mock's channel.
func (s *serverMock) CancelLoopOutSwap(ctx context.Context,
details *outCancelDetails) error {
s.cancelSwap <- details
return nil
}
func (s *serverMock) GetLoopInTerms(ctx context.Context) (
*LoopInTerms, error) {