mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
multi: add initiator to mocked interfaces for tests
This commit is contained in:
parent
921f4d06e7
commit
e9bc1dcc9e
4 changed files with 9 additions and 7 deletions
|
|
@ -135,7 +135,7 @@ func newAutoloopTestCtx(t *testing.T, parameters Parameters,
|
|||
|
||||
cfg := &Config{
|
||||
AutoloopTicker: ticker.NewForce(DefaultAutoloopTicker),
|
||||
Restrictions: func(_ context.Context, swapType swap.Type) (*Restrictions,
|
||||
Restrictions: func(_ context.Context, swapType swap.Type, initiator string) (*Restrictions,
|
||||
error) {
|
||||
|
||||
if swapType == swap.TypeOut {
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ func newTestConfig() (*Config, *test.LndMockServices) {
|
|||
)
|
||||
|
||||
return &Config{
|
||||
Restrictions: func(_ context.Context, _ swap.Type) (*Restrictions,
|
||||
Restrictions: func(_ context.Context, _ swap.Type, initiator string) (*Restrictions,
|
||||
error) {
|
||||
|
||||
return testRestrictions, nil
|
||||
|
|
@ -1318,7 +1318,8 @@ type mockServer struct {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
|
||||
args := m.Called(ctx, swapType)
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ func TestLoopinBuildSwap(t *testing.T) {
|
|||
Amount: swapAmt,
|
||||
LastHop: &peer1,
|
||||
HtlcConfTarget: htlcConfTarget,
|
||||
Initiator: autoloopSwapInitiator,
|
||||
}
|
||||
|
||||
errPrecondition = status.Error(codes.FailedPrecondition, "failed")
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ func (s *serverMock) NewLoopOutSwap(_ context.Context, swapHash lntypes.Hash,
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (s *serverMock) GetLoopOutTerms(ctx context.Context) (
|
||||
func (s *serverMock) GetLoopOutTerms(ctx context.Context, initiator string) (
|
||||
*LoopOutTerms, error) {
|
||||
|
||||
return &LoopOutTerms{
|
||||
|
|
@ -114,7 +114,7 @@ func (s *serverMock) GetLoopOutTerms(ctx context.Context) (
|
|||
}
|
||||
|
||||
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}
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ func (s *serverMock) assertSwapCanceled(t *testing.T, details *outCancelDetails)
|
|||
require.Equal(t, details, <-s.cancelSwap)
|
||||
}
|
||||
|
||||
func (s *serverMock) GetLoopInTerms(ctx context.Context) (
|
||||
func (s *serverMock) GetLoopInTerms(ctx context.Context, initiator string) (
|
||||
*LoopInTerms, error) {
|
||||
|
||||
return &LoopInTerms{
|
||||
|
|
@ -219,7 +219,7 @@ func (s *serverMock) GetLoopInTerms(ctx context.Context) (
|
|||
}
|
||||
|
||||
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{
|
||||
SwapFee: testSwapFee,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue