From 5a2769664aa902d0c8a2df9fe666799fb9ba1f5b Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 8 Nov 2017 19:27:13 -0800 Subject: [PATCH] rpcserver: populate pending channel resp with htlcs --- rpcserver.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rpcserver.go b/rpcserver.go index 42505167..ef4666d6 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1243,6 +1243,7 @@ func (r *rpcServer) PendingChannels(ctx context.Context, // we can ultimately sweep the funds into the wallet. if nurseryInfo != nil { forceClose.LimboBalance = int64(nurseryInfo.limboBalance) + forceClose.RecoveredBalance = int64(nurseryInfo.recoveredBalance) forceClose.MaturityHeight = nurseryInfo.maturityHeight // If the transaction has been confirmed, then @@ -1253,6 +1254,28 @@ func (r *rpcServer) PendingChannels(ctx context.Context, currentHeight } + for _, htlcReport := range nurseryInfo.htlcs { + // TODO(conner) set incoming flag + // appropriately after handling incoming + // incubation + htlc := &lnrpc.PendingHTLC{ + Incoming: false, + Amount: int64(htlcReport.amount), + Outpoint: htlcReport.outpoint.String(), + MaturityHeight: htlcReport.maturityHeight, + Stage: htlcReport.stage, + } + + if htlc.MaturityHeight != 0 { + htlc.BlocksTilMaturity = + int32(htlc.MaturityHeight) - + currentHeight + } + + forceClose.PendingHtlcs = append(forceClose.PendingHtlcs, + htlc) + } + resp.TotalLimboBalance += int64(nurseryInfo.limboBalance) }