Skip to content

Commit f7af7b4

Browse files
committed
loopd: arbitrary withdrawal amount for static address deposits
1 parent 3f39924 commit f7af7b4

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
@@ -143,7 +143,7 @@ var withdrawalCommand = cli.Command{
143143
Usage: "withdraws all static address deposits.",
144144
},
145145
cli.StringFlag{
146-
Name: "addr",
146+
Name: "dest_addr",
147147
Usage: "the optional address that the withdrawn " +
148148
"funds should be sent to, if let blank the " +
149149
"funds will go to lnd's wallet",
@@ -154,6 +154,12 @@ var withdrawalCommand = cli.Command{
154154
"sat/vbyte that should be used when crafting " +
155155
"the transaction",
156156
},
157+
cli.IntFlag{
158+
Name: "amount",
159+
Usage: "the number of satoshis that should be " +
160+
"withdrawn from the selected deposits. The " +
161+
"change is sent back to the static address",
162+
},
157163
},
158164
Action: withdraw,
159165
}
@@ -193,8 +199,8 @@ func withdraw(ctx *cli.Context) error {
193199
return fmt.Errorf("unknown withdrawal request")
194200
}
195201

196-
if ctx.IsSet("addr") {
197-
destAddr = ctx.String("addr")
202+
if ctx.IsSet("dest_addr") {
203+
destAddr = ctx.String("dest_addr")
198204
}
199205

200206
resp, err := client.WithdrawDeposits(ctxb,
@@ -203,6 +209,7 @@ func withdraw(ctx *cli.Context) error {
203209
All: isAllSelected,
204210
DestAddr: destAddr,
205211
SatPerVbyte: int64(ctx.Uint64("sat_per_vbyte")),
212+
Amount: ctx.Int64("amount"),
206213
})
207214
if err != nil {
208215
return err

loopd/swapclient_server.go

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

14491449
txhash, pkScript, err := s.withdrawalManager.DeliverWithdrawalRequest(
1450-
ctx, outpoints, req.DestAddr, req.SatPerVbyte,
1450+
ctx, outpoints, req.DestAddr, req.SatPerVbyte, req.Amount,
14511451
)
14521452
if err != nil {
14531453
return nil, err

0 commit comments

Comments
 (0)