Skip to content

Commit 5215222

Browse files
committed
cmd: print both htlc addresses when monitoring a loop-in
1 parent 0aa978b commit 5215222

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

cmd/loop/loopin.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ func loopIn(ctx *cli.Context) error {
153153

154154
fmt.Printf("Swap initiated\n")
155155
fmt.Printf("ID: %v\n", resp.Id)
156-
fmt.Printf("HTLC address: %v\n", resp.HtlcAddress)
156+
if external {
157+
fmt.Printf("HTLC address (NP2WSH): %v\n", resp.HtlcAddressNp2Wsh)
158+
}
159+
fmt.Printf("HTLC address (P2WSH): %v\n", resp.HtlcAddressP2Wsh)
157160
fmt.Println()
158161
fmt.Printf("Run `loop monitor` to monitor progress.\n")
159162

cmd/loop/main.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,24 @@ func parseAmt(text string) (btcutil.Amount, error) {
225225
}
226226

227227
func logSwap(swap *looprpc.SwapStatus) {
228-
fmt.Printf("%v %v %v %v - %v",
229-
time.Unix(0, swap.LastUpdateTime).Format(time.RFC3339),
230-
swap.Type, swap.State, btcutil.Amount(swap.Amt),
231-
swap.HtlcAddress,
232-
)
228+
if swap.Type == looprpc.SwapType_LOOP_OUT {
229+
fmt.Printf("%v %v %v %v - %v",
230+
time.Unix(0, swap.LastUpdateTime).Format(time.RFC3339),
231+
swap.Type, swap.State, btcutil.Amount(swap.Amt),
232+
swap.HtlcAddressP2Wsh,
233+
)
234+
} else {
235+
fmt.Printf("%v %v %v %v -",
236+
time.Unix(0, swap.LastUpdateTime).Format(time.RFC3339),
237+
swap.Type, swap.State, btcutil.Amount(swap.Amt))
238+
if swap.HtlcAddressP2Wsh != "" {
239+
fmt.Printf(" P2WSH: %v", swap.HtlcAddressP2Wsh)
240+
}
241+
242+
if swap.HtlcAddressNp2Wsh != "" {
243+
fmt.Printf(" NP2WSH: %v", swap.HtlcAddressNp2Wsh)
244+
}
245+
}
233246

234247
if swap.State != looprpc.SwapState_INITIATED &&
235248
swap.State != looprpc.SwapState_HTLC_PUBLISHED &&

0 commit comments

Comments
 (0)