Skip to content

Commit c7cc47b

Browse files
committed
loopd: arbitrary withdrawal amount for static address deposits
1 parent 2622882 commit c7cc47b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

cmd/loop/staticaddr.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ var withdrawalCommand = cli.Command{
148148
Usage: "withdraws all static address deposits.",
149149
},
150150
cli.StringFlag{
151-
Name: "addr",
151+
Name: "dest_addr",
152152
Usage: "the optional address that the withdrawn " +
153153
"funds should be sent to, if let blank the " +
154154
"funds will go to lnd's wallet",
@@ -159,6 +159,12 @@ var withdrawalCommand = cli.Command{
159159
"sat/vbyte that should be used when crafting " +
160160
"the transaction",
161161
},
162+
cli.IntFlag{
163+
Name: "amount",
164+
Usage: "the number of satoshis that should be " +
165+
"withdrawn from the selected deposits. The " +
166+
"change is sent back to the static address",
167+
},
162168
},
163169
Action: withdraw,
164170
}
@@ -198,8 +204,8 @@ func withdraw(ctx *cli.Context) error {
198204
return fmt.Errorf("unknown withdrawal request")
199205
}
200206

201-
if ctx.IsSet("addr") {
202-
destAddr = ctx.String("addr")
207+
if ctx.IsSet("dest_addr") {
208+
destAddr = ctx.String("dest_addr")
203209
}
204210

205211
resp, err := client.WithdrawDeposits(ctxb,
@@ -208,6 +214,7 @@ func withdraw(ctx *cli.Context) error {
208214
All: isAllSelected,
209215
DestAddr: destAddr,
210216
SatPerVbyte: int64(ctx.Uint64("sat_per_vbyte")),
217+
Amount: ctx.Int64("amount"),
211218
})
212219
if err != nil {
213220
return err

loopd/swapclient_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ func (s *swapClientServer) WithdrawDeposits(ctx context.Context,
15411541
}
15421542

15431543
txhash, pkScript, err := s.withdrawalManager.DeliverWithdrawalRequest(
1544-
ctx, outpoints, req.DestAddr, req.SatPerVbyte,
1544+
ctx, outpoints, req.DestAddr, req.SatPerVbyte, req.Amount,
15451545
)
15461546
if err != nil {
15471547
return nil, err

0 commit comments

Comments
 (0)