Skip to content

Commit

Permalink
test: integration tests for premium
Browse files Browse the repository at this point in the history
This commit is to modify and add integration tests
for the addition of premium.
  • Loading branch information
YusukeShimizu committed Dec 23, 2023
1 parent 1ec38e5 commit dc5b87f
Show file tree
Hide file tree
Showing 8 changed files with 1,539 additions and 965 deletions.
15 changes: 9 additions & 6 deletions peerswaprpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (p *PeerswapServer) SwapOut(ctx context.Context, request *SwapOutRequest) (
return nil, fmt.Errorf("peer is not connected")
}

swapOut, err := p.swaps.SwapOut(peerId, request.Asset, shortId.String(), pk, request.SwapAmount)
swapOut, err := p.swaps.SwapOut(peerId, request.Asset, shortId.String(), pk, request.SwapAmount, request.GetPremiumLimit())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -268,7 +268,7 @@ func (p *PeerswapServer) SwapIn(ctx context.Context, request *SwapInRequest) (*S
return nil, fmt.Errorf("peer is not connected")
}

swapIn, err := p.swaps.SwapIn(peerId, request.Asset, shortId.String(), pk, request.SwapAmount)
swapIn, err := p.swaps.SwapIn(peerId, request.Asset, shortId.String(), pk, request.SwapAmount, request.GetPremiumLimit())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -376,10 +376,12 @@ func (p *PeerswapServer) ListPeers(ctx context.Context, request *ListPeersReques
}

peerSwapPeers = append(peerSwapPeers, &PeerSwapPeer{
NodeId: v.PubKey,
SwapsAllowed: poll.PeerAllowed,
SupportedAssets: poll.Assets,
Channels: getPeerSwapChannels(v.PubKey, channelRes.Channels),
NodeId: v.PubKey,
SwapsAllowed: poll.PeerAllowed,
SwapInPremiumRatePpm: poll.SwapInPremiumRatePPM,
SwapOutPremiumRatePpm: poll.SwapOutPremiumRatePPM,
SupportedAssets: poll.Assets,
Channels: getPeerSwapChannels(v.PubKey, channelRes.Channels),
AsSender: &SwapStats{
SwapsOut: SenderSwapsOut,
SwapsIn: SenderSwapsIn,
Expand Down Expand Up @@ -571,6 +573,7 @@ func PrettyprintFromServiceSwap(swap *swap.SwapStateMachine) *PrettyPrintSwap {
ClaimTxId: swap.Data.ClaimTxId,
CancelMessage: swap.Data.GetCancelMessage(),
LndChanId: lnd_chan_id,
PremiumAmount: swap.Data.GetPremium(),
}
}

Expand Down
Loading

0 comments on commit dc5b87f

Please sign in to comment.