multi: use isExternalAddr flag

This commit is contained in:
George Tsagkarelis 2023-12-22 11:54:46 +01:00
parent 627eb5cb68
commit a9be69b281
No known key found for this signature in database
GPG key ID: E08DEA9B12B66AF6
7 changed files with 25 additions and 0 deletions

View file

@ -100,6 +100,7 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
log.Infof("Loop out request received")
var sweepAddr btcutil.Address
var isExternalAddr bool
var err error
//nolint:lll
switch {
@ -117,6 +118,8 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
return nil, fmt.Errorf("decode address: %v", err)
}
isExternalAddr = true
case in.Account != "" && in.AccountAddrType == clientrpc.AddressType_ADDRESS_TYPE_UNKNOWN:
return nil, liquidity.ErrAccountAndAddrType
@ -141,6 +144,8 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
"%v", err)
}
isExternalAddr = true
default:
// Generate sweep address if none specified.
sweepAddr, err = s.lnd.WalletKit.NextAddr(
@ -166,6 +171,7 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
req := &loop.OutRequest{
Amount: btcutil.Amount(in.Amt),
DestAddr: sweepAddr,
IsExternalAddr: isExternalAddr,
MaxMinerFee: btcutil.Amount(in.MaxMinerFee),
MaxPrepayAmount: btcutil.Amount(in.MaxPrepayAmt),
MaxPrepayRoutingFee: btcutil.Amount(in.MaxPrepayRoutingFee),