File tree Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
"github.com/btcsuite/btcd/btcutil"
13
13
"github.com/btcsuite/btcd/wire"
14
14
"github.com/go-errors/errors"
15
+ "github.com/lightningnetwork/lnd/fn/v2"
15
16
"github.com/lightningnetwork/lnd/graph/db/models"
16
17
"github.com/lightningnetwork/lnd/lnutils"
17
18
"github.com/lightningnetwork/lnd/lnwire"
@@ -360,6 +361,9 @@ type ChannelEdgeUpdate struct {
360
361
// payments.
361
362
Disabled bool
362
363
364
+ // InboundFee is the fee that must be paid for incoming HTLCs.
365
+ InboundFee fn.Option [lnwire.Fee ]
366
+
363
367
// ExtraOpaqueData is the set of data that was appended to this message
364
368
// to fill out the full maximum transport message size. These fields can
365
369
// be used to specify optional data such as custom TLV fields.
@@ -442,6 +446,7 @@ func (c *ChannelGraph) addToTopologyChange(update *TopologyChange,
442
446
AdvertisingNode : aNode ,
443
447
ConnectingNode : cNode ,
444
448
Disabled : m .ChannelFlags & lnwire .ChanUpdateDisabled != 0 ,
449
+ InboundFee : m .InboundFee ,
445
450
ExtraOpaqueData : m .ExtraOpaqueData ,
446
451
}
447
452
Original file line number Diff line number Diff line change @@ -6776,23 +6776,6 @@ func marshalExtraOpaqueData(data []byte) map[uint64][]byte {
6776
6776
return records
6777
6777
}
6778
6778
6779
- // extractInboundFeeSafe tries to extract the inbound fee from the given extra
6780
- // opaque data tlv block. If parsing fails, a zero inbound fee is returned. This
6781
- // function is typically used on unvalidated data coming stored in the database.
6782
- // There is not much we can do other than ignoring errors here.
6783
- func extractInboundFeeSafe (data lnwire.ExtraOpaqueData ) lnwire.Fee {
6784
- var inboundFee lnwire.Fee
6785
-
6786
- _ , err := data .ExtractRecords (& inboundFee )
6787
- if err != nil {
6788
- // Return zero fee. Do not return the inboundFee variable
6789
- // because it may be undefined.
6790
- return lnwire.Fee {}
6791
- }
6792
-
6793
- return inboundFee
6794
- }
6795
-
6796
6779
func marshalDBEdge (edgeInfo * models.ChannelEdgeInfo ,
6797
6780
c1 , c2 * models.ChannelEdgePolicy ) * lnrpc.ChannelEdge {
6798
6781
@@ -7349,9 +7332,7 @@ func marshallTopologyChange(
7349
7332
customRecords := marshalExtraOpaqueData (
7350
7333
channelUpdate .ExtraOpaqueData ,
7351
7334
)
7352
- inboundFee := extractInboundFeeSafe (
7353
- channelUpdate .ExtraOpaqueData ,
7354
- )
7335
+ inboundFee := channelUpdate .InboundFee .UnwrapOr (lnwire.Fee {})
7355
7336
7356
7337
channelUpdates [i ] = & lnrpc.ChannelEdgeUpdate {
7357
7338
ChanId : channelUpdate .ChanID ,
You can’t perform that action at this time.
0 commit comments