@@ -288,10 +288,11 @@ var sendCoinsCommand = cli.Command{
288288 },
289289 cli.BoolFlag {
290290 Name : "sweepall" ,
291- Usage : "if set, then the amount field will be ignored, " +
292- "and the wallet will attempt to sweep all " +
293- "outputs within the wallet to the target " +
294- "address" ,
291+ Usage : "if set, then the amount field should be " +
292+ "unset. This indicates that the wallet will " +
293+ "attempt to sweep all outputs within the " +
294+ "wallet or all funds in select utxos (when " +
295+ "supplied) to the target address" ,
295296 },
296297 cli.Int64Flag {
297298 Name : "amt" ,
@@ -330,16 +331,28 @@ var sendCoinsCommand = cli.Command{
330331 "scripts" ,
331332 },
332333 coinSelectionStrategyFlag ,
334+ cli.StringSliceFlag {
335+ Name : "utxo" ,
336+ Usage : "a utxo specified as outpoint(tx:idx) which " +
337+ "will be used as input for the transaction. " +
338+ "This flag can be repeatedly used to specify " +
339+ "multiple utxos as inputs. The selected " +
340+ "utxos can either be entirely spent by " +
341+ "specifying the sweepall flag or a specified " +
342+ "amount can be spent in the utxos through " +
343+ "the amt flag" ,
344+ },
333345 txLabelFlag ,
334346 },
335347 Action : actionDecorator (sendCoins ),
336348}
337349
338350func sendCoins (ctx * cli.Context ) error {
339351 var (
340- addr string
341- amt int64
342- err error
352+ addr string
353+ amt int64
354+ err error
355+ outpoints []* lnrpc.OutPoint
343356 )
344357 ctxc := getContext ()
345358 args := ctx .Args ()
@@ -417,6 +430,15 @@ func sendCoins(ctx *cli.Context) error {
417430 displayAmt = balanceResponse .GetConfirmedBalance ()
418431 }
419432
433+ if ctx .IsSet ("utxo" ) {
434+ utxos := ctx .StringSlice ("utxo" )
435+
436+ outpoints , err = UtxosToOutpoints (utxos )
437+ if err != nil {
438+ return fmt .Errorf ("unable to decode utxos: %w" , err )
439+ }
440+ }
441+
420442 // Ask for confirmation if we're on an actual terminal and the output is
421443 // not being redirected to another command. This prevents existing shell
422444 // scripts from breaking.
@@ -440,6 +462,7 @@ func sendCoins(ctx *cli.Context) error {
440462 MinConfs : minConfs ,
441463 SpendUnconfirmed : minConfs == 0 ,
442464 CoinSelectionStrategy : coinSelectionStrategy ,
465+ Outpoints : outpoints ,
443466 }
444467 txid , err := client .SendCoins (ctxc , req )
445468 if err != nil {
0 commit comments