Skip to content

Commit

Permalink
loopd: arbitrary withdrawal amount for static address deposits
Browse files Browse the repository at this point in the history
  • Loading branch information
hieblmi committed Dec 5, 2024
1 parent b646ed1 commit 827a65b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions cmd/loop/staticaddr.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ var withdrawalCommand = cli.Command{
Usage: "withdraws all static address deposits.",
},
cli.StringFlag{
Name: "addr",
Name: "dest_addr",
Usage: "the optional address that the withdrawn " +
"funds should be sent to, if let blank the " +
"funds will go to lnd's wallet",
Expand All @@ -157,6 +157,12 @@ var withdrawalCommand = cli.Command{
"sat/vbyte that should be used when crafting " +
"the transaction",
},
cli.IntFlag{
Name: "amount",
Usage: "the number of satoshis that should be " +
"withdrawn from the selected deposits. The " +
"change is sent back to the static address",
},
},
Action: withdraw,
}
Expand Down Expand Up @@ -196,8 +202,8 @@ func withdraw(ctx *cli.Context) error {
return fmt.Errorf("unknown withdrawal request")
}

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

resp, err := client.WithdrawDeposits(ctxb,
Expand All @@ -206,6 +212,7 @@ func withdraw(ctx *cli.Context) error {
All: isAllSelected,
DestAddr: destAddr,
SatPerVbyte: int64(ctx.Uint64("sat_per_vbyte")),
Amount: ctx.Int64("amount"),
})
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, req.DestAddr, req.SatPerVbyte,
ctx, outpoints, req.DestAddr, req.SatPerVbyte, req.Amount,
)
if err != nil {
return nil, err
Expand Down

0 comments on commit 827a65b

Please sign in to comment.