Skip to content

Commit e9bc1dc

Browse files
committed
multi: add initiator to mocked interfaces for tests
1 parent 921f4d0 commit e9bc1dc

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

liquidity/autoloop_testcontext_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func newAutoloopTestCtx(t *testing.T, parameters Parameters,
135135

136136
cfg := &Config{
137137
AutoloopTicker: ticker.NewForce(DefaultAutoloopTicker),
138-
Restrictions: func(_ context.Context, swapType swap.Type) (*Restrictions,
138+
Restrictions: func(_ context.Context, swapType swap.Type, initiator string) (*Restrictions,
139139
error) {
140140

141141
if swapType == swap.TypeOut {

liquidity/liquidity_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func newTestConfig() (*Config, *test.LndMockServices) {
147147
)
148148

149149
return &Config{
150-
Restrictions: func(_ context.Context, _ swap.Type) (*Restrictions,
150+
Restrictions: func(_ context.Context, _ swap.Type, initiator string) (*Restrictions,
151151
error) {
152152

153153
return testRestrictions, nil
@@ -1318,7 +1318,8 @@ type mockServer struct {
13181318
}
13191319

13201320
// Restrictions mocks a call to the server to get swap size restrictions.
1321-
func (m *mockServer) Restrictions(ctx context.Context, swapType swap.Type) (
1321+
func (m *mockServer) Restrictions(ctx context.Context, swapType swap.Type,
1322+
initiator string) (
13221323
*Restrictions, error) {
13231324

13241325
args := m.Called(ctx, swapType)

liquidity/loopin_builder_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func TestLoopinBuildSwap(t *testing.T) {
113113
Amount: swapAmt,
114114
LastHop: &peer1,
115115
HtlcConfTarget: htlcConfTarget,
116+
Initiator: autoloopSwapInitiator,
116117
}
117118

118119
errPrecondition = status.Error(codes.FailedPrecondition, "failed")

server_mock_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (s *serverMock) NewLoopOutSwap(_ context.Context, swapHash lntypes.Hash,
102102
}, nil
103103
}
104104

105-
func (s *serverMock) GetLoopOutTerms(ctx context.Context) (
105+
func (s *serverMock) GetLoopOutTerms(ctx context.Context, initiator string) (
106106
*LoopOutTerms, error) {
107107

108108
return &LoopOutTerms{
@@ -114,7 +114,7 @@ func (s *serverMock) GetLoopOutTerms(ctx context.Context) (
114114
}
115115

116116
func (s *serverMock) GetLoopOutQuote(ctx context.Context, amt btcutil.Amount,
117-
expiry int32, _ time.Time) (*LoopOutQuote, error) {
117+
expiry int32, _ time.Time, initiator string) (*LoopOutQuote, error) {
118118

119119
dest := [33]byte{1, 2, 3}
120120

@@ -209,7 +209,7 @@ func (s *serverMock) assertSwapCanceled(t *testing.T, details *outCancelDetails)
209209
require.Equal(t, details, <-s.cancelSwap)
210210
}
211211

212-
func (s *serverMock) GetLoopInTerms(ctx context.Context) (
212+
func (s *serverMock) GetLoopInTerms(ctx context.Context, initiator string) (
213213
*LoopInTerms, error) {
214214

215215
return &LoopInTerms{
@@ -219,7 +219,7 @@ func (s *serverMock) GetLoopInTerms(ctx context.Context) (
219219
}
220220

221221
func (s *serverMock) GetLoopInQuote(context.Context, btcutil.Amount,
222-
route.Vertex, *route.Vertex, [][]zpay32.HopHint) (*LoopInQuote, error) {
222+
route.Vertex, *route.Vertex, [][]zpay32.HopHint, string) (*LoopInQuote, error) {
223223

224224
return &LoopInQuote{
225225
SwapFee: testSwapFee,

0 commit comments

Comments
 (0)