multi: add initiator to mocked interfaces for tests

pull/600/head
George Tsagkarelis 10 months ago
parent 921f4d06e7
commit e9bc1dcc9e
No known key found for this signature in database
GPG Key ID: 0807D1013F48208A

@ -135,7 +135,7 @@ func newAutoloopTestCtx(t *testing.T, parameters Parameters,
cfg := &Config{ cfg := &Config{
AutoloopTicker: ticker.NewForce(DefaultAutoloopTicker), AutoloopTicker: ticker.NewForce(DefaultAutoloopTicker),
Restrictions: func(_ context.Context, swapType swap.Type) (*Restrictions, Restrictions: func(_ context.Context, swapType swap.Type, initiator string) (*Restrictions,
error) { error) {
if swapType == swap.TypeOut { if swapType == swap.TypeOut {

@ -147,7 +147,7 @@ func newTestConfig() (*Config, *test.LndMockServices) {
) )
return &Config{ return &Config{
Restrictions: func(_ context.Context, _ swap.Type) (*Restrictions, Restrictions: func(_ context.Context, _ swap.Type, initiator string) (*Restrictions,
error) { error) {
return testRestrictions, nil return testRestrictions, nil
@ -1318,7 +1318,8 @@ type mockServer struct {
} }
// Restrictions mocks a call to the server to get swap size restrictions. // Restrictions mocks a call to the server to get swap size restrictions.
func (m *mockServer) Restrictions(ctx context.Context, swapType swap.Type) ( func (m *mockServer) Restrictions(ctx context.Context, swapType swap.Type,
initiator string) (
*Restrictions, error) { *Restrictions, error) {
args := m.Called(ctx, swapType) args := m.Called(ctx, swapType)

@ -113,6 +113,7 @@ func TestLoopinBuildSwap(t *testing.T) {
Amount: swapAmt, Amount: swapAmt,
LastHop: &peer1, LastHop: &peer1,
HtlcConfTarget: htlcConfTarget, HtlcConfTarget: htlcConfTarget,
Initiator: autoloopSwapInitiator,
} }
errPrecondition = status.Error(codes.FailedPrecondition, "failed") errPrecondition = status.Error(codes.FailedPrecondition, "failed")

@ -102,7 +102,7 @@ func (s *serverMock) NewLoopOutSwap(_ context.Context, swapHash lntypes.Hash,
}, nil }, nil
} }
func (s *serverMock) GetLoopOutTerms(ctx context.Context) ( func (s *serverMock) GetLoopOutTerms(ctx context.Context, initiator string) (
*LoopOutTerms, error) { *LoopOutTerms, error) {
return &LoopOutTerms{ return &LoopOutTerms{
@ -114,7 +114,7 @@ func (s *serverMock) GetLoopOutTerms(ctx context.Context) (
} }
func (s *serverMock) GetLoopOutQuote(ctx context.Context, amt btcutil.Amount, func (s *serverMock) GetLoopOutQuote(ctx context.Context, amt btcutil.Amount,
expiry int32, _ time.Time) (*LoopOutQuote, error) { expiry int32, _ time.Time, initiator string) (*LoopOutQuote, error) {
dest := [33]byte{1, 2, 3} dest := [33]byte{1, 2, 3}
@ -209,7 +209,7 @@ func (s *serverMock) assertSwapCanceled(t *testing.T, details *outCancelDetails)
require.Equal(t, details, <-s.cancelSwap) require.Equal(t, details, <-s.cancelSwap)
} }
func (s *serverMock) GetLoopInTerms(ctx context.Context) ( func (s *serverMock) GetLoopInTerms(ctx context.Context, initiator string) (
*LoopInTerms, error) { *LoopInTerms, error) {
return &LoopInTerms{ return &LoopInTerms{
@ -219,7 +219,7 @@ func (s *serverMock) GetLoopInTerms(ctx context.Context) (
} }
func (s *serverMock) GetLoopInQuote(context.Context, btcutil.Amount, func (s *serverMock) GetLoopInQuote(context.Context, btcutil.Amount,
route.Vertex, *route.Vertex, [][]zpay32.HopHint) (*LoopInQuote, error) { route.Vertex, *route.Vertex, [][]zpay32.HopHint, string) (*LoopInQuote, error) {
return &LoopInQuote{ return &LoopInQuote{
SwapFee: testSwapFee, SwapFee: testSwapFee,

Loading…
Cancel
Save