mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
multi: loop in swap
This commit is contained in:
parent
6a0a9556a0
commit
3e960b8b54
28 changed files with 2376 additions and 273 deletions
|
|
@ -19,6 +19,7 @@ var (
|
|||
testTime = time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC)
|
||||
|
||||
testLoopOutOnChainCltvDelta = int32(30)
|
||||
testChargeOnChainCltvDelta = int32(100)
|
||||
testCltvDelta = 50
|
||||
testSwapFeeBase = btcutil.Amount(21)
|
||||
testSwapFeeRate = int64(100)
|
||||
|
|
@ -123,3 +124,40 @@ func getInvoice(hash lntypes.Hash, amt btcutil.Amount, memo string) (string, err
|
|||
|
||||
return reqString, nil
|
||||
}
|
||||
|
||||
func (s *serverMock) NewLoopInSwap(ctx context.Context,
|
||||
swapHash lntypes.Hash, amount btcutil.Amount,
|
||||
senderKey [33]byte, swapInvoice string) (
|
||||
*newLoopInResponse, error) {
|
||||
|
||||
_, receiverKey := test.CreateKey(101)
|
||||
|
||||
if amount != s.expectedSwapAmt {
|
||||
return nil, errors.New("unexpected test swap amount")
|
||||
}
|
||||
|
||||
var receiverKeyArray [33]byte
|
||||
copy(receiverKeyArray[:], receiverKey.SerializeCompressed())
|
||||
|
||||
s.swapInvoice = swapInvoice
|
||||
s.swapHash = swapHash
|
||||
|
||||
resp := &newLoopInResponse{
|
||||
expiry: s.height + testChargeOnChainCltvDelta,
|
||||
receiverKey: receiverKeyArray,
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *serverMock) GetLoopInTerms(ctx context.Context) (
|
||||
*LoopInTerms, error) {
|
||||
|
||||
return &LoopInTerms{
|
||||
SwapFeeBase: testSwapFeeBase,
|
||||
SwapFeeRate: testSwapFeeRate,
|
||||
CltvDelta: testChargeOnChainCltvDelta,
|
||||
MinSwapAmount: testMinSwapAmount,
|
||||
MaxSwapAmount: testMaxSwapAmount,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue