lnrpc+rpcserver: populate experimental MPP fields in ListPayment rpc

This commit is contained in:
Conner Fromknecht
2019-11-19 20:41:44 -08:00
parent d1f245e791
commit 997500b08d
2 changed files with 59 additions and 0 deletions

View File

@@ -4379,13 +4379,25 @@ func (r *rpcServer) ListPayments(ctx context.Context,
return nil, err
}
htlcs := make([]*lnrpc.HTLCAttempt, 0, len(payment.HTLCs))
for _, dbHTLC := range payment.HTLCs {
htlc, err := r.routerBackend.MarshalHTLCAttempt(dbHTLC)
if err != nil {
return nil, err
}
htlcs = append(htlcs, htlc)
}
paymentHash := payment.Info.PaymentHash
creationTimeNS := routerrpc.MarshalTimeNano(payment.Info.CreationTime)
paymentsResp.Payments = append(paymentsResp.Payments, &lnrpc.Payment{
PaymentHash: hex.EncodeToString(paymentHash[:]),
Value: satValue,
ValueMsat: msatValue,
ValueSat: satValue,
CreationDate: payment.Info.CreationTime.Unix(),
CreationTimeNs: creationTimeNS,
Path: path,
Fee: int64(route.TotalFees().ToSatoshis()),
FeeSat: int64(route.TotalFees().ToSatoshis()),
@@ -4393,6 +4405,7 @@ func (r *rpcServer) ListPayments(ctx context.Context,
PaymentPreimage: hex.EncodeToString(preimage[:]),
PaymentRequest: string(payment.Info.PaymentRequest),
Status: status,
Htlcs: htlcs,
})
}