Skip to content

Commit

Permalink
Merge pull request #356 from Impa10r/master
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeShimizu authored Feb 16, 2025
2 parents 10abc45 + ef79be4 commit 73e8c75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion swap/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ func (r *PayFeeInvoiceAction) Execute(services *SwapServices, swap *SwapData) Ev
requiredBalance := swap.SwapOutRequest.Amount*1000 + msatAmt

// Check if the spendable balance (sp) is sufficient
if sp <= requiredBalance {
if sp < requiredBalance {
return swap.HandleError(fmt.Errorf("not enough spendable msat: %d, expected: %d", sp, requiredBalance))
}

Expand Down
8 changes: 4 additions & 4 deletions swap/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func (s *SwapService) SwapOut(peer string, chain string, channelId string, initi
if err != nil {
return nil, err
}
if sp <= amtSat*1000 {
if sp < amtSat*1000 {
return nil, fmt.Errorf("exceeding spendable amount_msat: %d", sp)
}

Expand Down Expand Up @@ -460,7 +460,7 @@ func (s *SwapService) SwapIn(peer string, chain string, channelId string, initia
if err != nil {
return nil, err
}
if rs <= amtSat*1000 {
if rs < amtSat*1000 {
return nil, fmt.Errorf("exceeding receivable amount_msat: %d", rs)
}
maximumSwapAmountSat, err := s.estimateMaximumSwapAmountSat(chain)
Expand Down Expand Up @@ -565,7 +565,7 @@ func (s *SwapService) OnSwapInRequestReceived(swapId *SwapId, peerId string, mes
return err
}

if sp <= message.Amount*1000 {
if sp < message.Amount*1000 {
err = fmt.Errorf("exceeding spendable amount_msat: %d", sp)
msg := fmt.Sprintf("from the %s peer: %s", s.swapServices.lightning.Implementation(), err.Error())
// We want to tell our peer why we can not do this swap.
Expand Down Expand Up @@ -633,7 +633,7 @@ func (s *SwapService) OnSwapOutRequestReceived(swapId *SwapId, peerId string, me
return err
}

if rs <= message.Amount*1000 {
if rs < message.Amount*1000 {
err = fmt.Errorf("exceeding receivable amount_msat: %d", rs)
msg := fmt.Sprintf("from the %s peer: %s", s.swapServices.lightning.Implementation(), err.Error())
// We want to tell our peer why we can not do this swap.
Expand Down

0 comments on commit 73e8c75

Please sign in to comment.