Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions cmd/loop/staticaddr.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build staticaddr
// +build staticaddr

package main

import (
Expand Down Expand Up @@ -145,6 +142,18 @@ var withdrawalCommand = cli.Command{
Name: "all",
Usage: "withdraws all static address deposits.",
},
cli.StringFlag{
Name: "addr",
Usage: "the optional address that the withdrawn " +
"funds should be sent to, if let blank the " +
"funds will go to lnd's wallet",
},
cli.Int64Flag{
Name: "sat_per_vbyte",
Usage: "(optional) a manual fee expressed in " +
"sat/vbyte that should be used when crafting " +
"the transaction",
},
},
Action: withdraw,
}
Expand All @@ -165,6 +174,7 @@ func withdraw(ctx *cli.Context) error {
isUtxoSelected = ctx.IsSet("utxo")
outpoints []*looprpc.OutPoint
ctxb = context.Background()
destAddr string
)

switch {
Expand All @@ -183,10 +193,16 @@ func withdraw(ctx *cli.Context) error {
return fmt.Errorf("unknown withdrawal request")
}

if ctx.IsSet("addr") {
destAddr = ctx.String("addr")
}

resp, err := client.WithdrawDeposits(ctxb,
&looprpc.WithdrawDepositsRequest{
Outpoints: outpoints,
All: isAllSelected,
Outpoints: outpoints,
All: isAllSelected,
DestAddr: destAddr,
SatPerVbyte: int64(ctx.Uint64("sat_per_vbyte")),
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion loopd/swapclient_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ func (s *swapClientServer) WithdrawDeposits(ctx context.Context,
}

txhash, pkScript, err := s.withdrawalManager.DeliverWithdrawalRequest(
ctx, outpoints,
ctx, outpoints, req.DestAddr, req.SatPerVbyte,
)
if err != nil {
return nil, err
Expand Down
Loading
Loading