rpcserver: populate pending channel resp with htlcs

This commit is contained in:
Conner Fromknecht 2017-11-08 19:27:13 -08:00
parent eee4c225bf
commit 5a2769664a
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

@ -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)
}