lnrpc+rpcserver: encode custom records as custom channel data
With this commit we encode the custom records as a TLV stream into the custom channel data field of the invoice HTLC. This allows the custom data parser to parse those records and replace it with human-readable JSON on the RPC interface.
This commit is contained in:
9 files changed
+144
-5
No files matched your search
@@ -123,6 +123,16 @@ func CreateRPCInvoice(invoice *invoices.Invoice,
|
||||
MppTotalAmtMsat: uint64(htlc.MppTotalAmt),
|
||||
}
|
||||
|
||||
// The custom channel data is currently just the raw bytes of
|
||||
// the encoded custom records.
|
||||
customData, err := lnwire.CustomRecords(
|
||||
htlc.CustomRecords,
|
||||
).Serialize()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rpcHtlc.CustomChannelData = customData
|
||||
|
||||
// Populate any fields relevant to AMP payments.
|
||||
if htlc.AMP != nil {
|
||||
rootShare := htlc.AMP.Record.RootShare()
|
||||
|
||||
Reference in new issue
Block a user