@@ -424,6 +424,10 @@ type ChannelInfo struct {
424424 // AliasScids contains a list of alias short channel identifiers that
425425 // may be used for this channel. This array can be empty.
426426 AliasScids []uint64
427+
428+ // CustomChannelData is an optional field that can be used to store
429+ // data for custom channels.
430+ CustomChannelData []byte
427431}
428432
429433func (s * lightningClient ) newChannelInfo (channel * lnrpc.Channel ) (* ChannelInfo ,
@@ -465,8 +469,9 @@ func (s *lightningClient) newChannelInfo(channel *lnrpc.Channel) (*ChannelInfo,
465469 RemoteConstraints : newChannelConstraint (
466470 channel .RemoteConstraints ,
467471 ),
468- ZeroConf : channel .ZeroConf ,
469- ZeroConfScid : channel .ZeroConfConfirmedScid ,
472+ ZeroConf : channel .ZeroConf ,
473+ ZeroConfScid : channel .ZeroConfConfirmedScid ,
474+ CustomChannelData : channel .CustomChannelData ,
470475 }
471476
472477 chanInfo .AliasScids = make ([]uint64 , len (channel .AliasScids ))
@@ -834,6 +839,10 @@ type ChannelBalance struct {
834839
835840 // PendingBalance is the sum of all pending channel balances.
836841 PendingBalance btcutil.Amount
842+
843+ // CustomChannelData is an optional field that can be used to store
844+ // data for custom channels.
845+ CustomChannelData []byte
837846}
838847
839848// Node describes a node in the network.
@@ -1679,6 +1688,10 @@ type InvoiceHtlc struct {
16791688
16801689 // CustomRecords is list of the custom tlv records.
16811690 CustomRecords map [uint64 ][]byte
1691+
1692+ // CustomChannelData is an optional field that can be used to store
1693+ // data for custom channels.
1694+ CustomChannelData []byte
16821695}
16831696
16841697// PendingHtlc represents a HTLC that is currently pending on some channel.
@@ -1777,10 +1790,13 @@ func unmarshalInvoice(resp *lnrpc.Invoice) (*Invoice, error) {
17771790
17781791 for i , htlc := range resp .Htlcs {
17791792 invoiceHtlc := InvoiceHtlc {
1780- ChannelID : lnwire .NewShortChanIDFromInt (htlc .ChanId ),
1781- Amount : lnwire .MilliSatoshi (htlc .AmtMsat ),
1782- CustomRecords : htlc .CustomRecords ,
1783- State : htlc .State ,
1793+ ChannelID : lnwire .NewShortChanIDFromInt (
1794+ htlc .ChanId ,
1795+ ),
1796+ Amount : lnwire .MilliSatoshi (htlc .AmtMsat ),
1797+ CustomRecords : htlc .CustomRecords ,
1798+ State : htlc .State ,
1799+ CustomChannelData : htlc .CustomChannelData ,
17841800 }
17851801
17861802 if htlc .AcceptTime != 0 {
@@ -1971,6 +1987,10 @@ type PendingChannel struct {
19711987
19721988 // ChannelInitiator indicates which party opened the channel.
19731989 ChannelInitiator Initiator
1990+
1991+ // CustomChannelData is an optional field that can be used to store
1992+ // data for custom channels.
1993+ CustomChannelData []byte
19741994}
19751995
19761996// NewPendingChannel creates a pending channel from the rpc struct.
@@ -1993,12 +2013,13 @@ func NewPendingChannel(channel *lnrpc.PendingChannelsResponse_PendingChannel) (
19932013 }
19942014
19952015 return & PendingChannel {
1996- ChannelPoint : outpoint ,
1997- PubKeyBytes : peer ,
1998- Capacity : btcutil .Amount (channel .Capacity ),
1999- LocalBalance : btcutil .Amount (channel .LocalBalance ),
2000- RemoteBalance : btcutil .Amount (channel .RemoteBalance ),
2001- ChannelInitiator : initiator ,
2016+ ChannelPoint : outpoint ,
2017+ PubKeyBytes : peer ,
2018+ Capacity : btcutil .Amount (channel .Capacity ),
2019+ LocalBalance : btcutil .Amount (channel .LocalBalance ),
2020+ RemoteBalance : btcutil .Amount (channel .RemoteBalance ),
2021+ ChannelInitiator : initiator ,
2022+ CustomChannelData : channel .CustomChannelData ,
20022023 }, nil
20032024}
20042025
@@ -2473,6 +2494,10 @@ type Payment struct {
24732494
24742495 // SequenceNumber is a unique id for each payment.
24752496 SequenceNumber uint64
2497+
2498+ // FirstHopCustomRecords holds the custom TLV records that were sent to
2499+ // the first hop as part of the wire message.
2500+ FirstHopCustomRecords map [uint64 ][]byte
24762501}
24772502
24782503// ListPaymentsRequest contains the request parameters for a paginated
@@ -2540,9 +2565,14 @@ func (s *lightningClient) ListPayments(ctx context.Context,
25402565 PaymentRequest : payment .PaymentRequest ,
25412566 Status : status ,
25422567 Htlcs : payment .Htlcs ,
2543- Amount : lnwire .MilliSatoshi (payment .ValueMsat ),
2544- Fee : lnwire .MilliSatoshi (payment .FeeMsat ),
2545- SequenceNumber : payment .PaymentIndex ,
2568+ Amount : lnwire .MilliSatoshi (
2569+ payment .ValueMsat ,
2570+ ),
2571+ Fee : lnwire .MilliSatoshi (
2572+ payment .FeeMsat ,
2573+ ),
2574+ SequenceNumber : payment .PaymentIndex ,
2575+ FirstHopCustomRecords : payment .FirstHopCustomRecords ,
25462576 }
25472577
25482578 // Add our preimage if it is known.
@@ -3454,8 +3484,11 @@ func (s *lightningClient) ChannelBalance(ctx context.Context) (*ChannelBalance,
34543484 }
34553485
34563486 return & ChannelBalance {
3457- Balance : btcutil .Amount (resp .Balance ), // nolint:staticcheck
3458- PendingBalance : btcutil .Amount (resp .PendingOpenBalance ), // nolint:staticcheck
3487+ //nolint:staticcheck
3488+ Balance : btcutil .Amount (resp .Balance ),
3489+ //nolint:staticcheck
3490+ PendingBalance : btcutil .Amount (resp .PendingOpenBalance ),
3491+ CustomChannelData : resp .CustomChannelData ,
34593492 }, nil
34603493}
34613494
0 commit comments