@@ -40,6 +40,7 @@ func instantOut(ctx *cli.Context) error {
4040 // Otherwise, strings.Split returns a slice of length one with an empty
4141 // element.
4242 var outgoingChanSet []uint64
43+
4344 if ctx .IsSet ("channel" ) {
4445 chanStrings := strings .Split (ctx .String ("channel" ), "," )
4546 for _ , chanString := range chanStrings {
@@ -48,6 +49,7 @@ func instantOut(ctx *cli.Context) error {
4849 return fmt .Errorf ("error parsing channel id " +
4950 "\" %v\" " , chanString )
5051 }
52+
5153 outgoingChanSet = append (outgoingChanSet , chanID )
5254 }
5355 }
@@ -87,6 +89,7 @@ func instantOut(ctx *cli.Context) error {
8789 }
8890
8991 fmt .Printf ("Available reservations: \n \n " )
92+
9093 for _ , res := range confirmedReservations {
9194 idx ++
9295 fmt .Printf ("Reservation %v: shortid %x, amt %v, expiry " +
@@ -111,6 +114,7 @@ func instantOut(ctx *cli.Context) error {
111114 selectedReservations [][]byte
112115 selectedAmt uint64
113116 )
117+
114118 switch answer {
115119 case "ALL" :
116120 for _ , res := range confirmedReservations {
@@ -127,18 +131,21 @@ func instantOut(ctx *cli.Context) error {
127131 default :
128132 selectedIndexes := strings .Split (answer , "," )
129133 selectedIndexMap := make (map [int ]struct {})
134+
130135 for _ , idxStr := range selectedIndexes {
131136 idx , err := strconv .Atoi (idxStr )
132137 if err != nil {
133138 return err
134139 }
140+
135141 if idx < 0 {
136142 return fmt .Errorf ("invalid index %v" , idx )
137143 }
138144
139145 if idx > len (confirmedReservations ) {
140146 return fmt .Errorf ("invalid index %v" , idx )
141147 }
148+
142149 if _ , ok := selectedIndexMap [idx ]; ok {
143150 return fmt .Errorf ("duplicate index %v" , idx )
144151 }
@@ -164,6 +171,7 @@ func instantOut(ctx *cli.Context) error {
164171 if err != nil {
165172 return err
166173 }
174+
167175 fmt .Println ()
168176 fmt .Printf (satAmtFmt , "Estimated on-chain fee:" , quote .SweepFeeSat )
169177 fmt .Printf (satAmtFmt , "Service fee:" , quote .ServiceFeeSat )
@@ -172,6 +180,7 @@ func instantOut(ctx *cli.Context) error {
172180 fmt .Printf ("CONTINUE SWAP? (y/n): " )
173181
174182 fmt .Scanln (& answer )
183+
175184 if answer != "y" {
176185 return errors .New ("swap canceled" )
177186 }
@@ -187,7 +196,6 @@ func instantOut(ctx *cli.Context) error {
187196 DestAddr : ctx .String ("addr" ),
188197 },
189198 )
190-
191199 if err != nil {
192200 return err
193201 }
@@ -228,5 +236,6 @@ func listInstantOuts(ctx *cli.Context) error {
228236 }
229237
230238 printRespJSON (resp )
239+
231240 return nil
232241}
0 commit comments