feat: add inbound fees to channel notifications

This commit is contained in:
Bufo
2024-05-07 18:58:25 +02:00
parent 399ea864da
commit af9858c3ed
4 changed files with 59 additions and 10 deletions

View File

@ -6691,6 +6691,14 @@ func marshallTopologyChange(topChange *routing.TopologyChange) *lnrpc.GraphTopol
channelUpdates := make([]*lnrpc.ChannelEdgeUpdate, len(topChange.ChannelEdgeUpdates))
for i, channelUpdate := range topChange.ChannelEdgeUpdates {
customRecords := marshalExtraOpaqueData(
channelUpdate.ExtraOpaqueData,
)
inboundFee := extractInboundFeeSafe(
channelUpdate.ExtraOpaqueData,
)
channelUpdates[i] = &lnrpc.ChannelEdgeUpdate{
ChanId: channelUpdate.ChanID,
ChanPoint: &lnrpc.ChannelPoint{
@ -6701,12 +6709,25 @@ func marshallTopologyChange(topChange *routing.TopologyChange) *lnrpc.GraphTopol
},
Capacity: int64(channelUpdate.Capacity),
RoutingPolicy: &lnrpc.RoutingPolicy{
TimeLockDelta: uint32(channelUpdate.TimeLockDelta),
MinHtlc: int64(channelUpdate.MinHTLC),
MaxHtlcMsat: uint64(channelUpdate.MaxHTLC),
FeeBaseMsat: int64(channelUpdate.BaseFee),
FeeRateMilliMsat: int64(channelUpdate.FeeRate),
Disabled: channelUpdate.Disabled,
TimeLockDelta: uint32(
channelUpdate.TimeLockDelta,
),
MinHtlc: int64(
channelUpdate.MinHTLC,
),
MaxHtlcMsat: uint64(
channelUpdate.MaxHTLC,
),
FeeBaseMsat: int64(
channelUpdate.BaseFee,
),
FeeRateMilliMsat: int64(
channelUpdate.FeeRate,
),
Disabled: channelUpdate.Disabled,
InboundFeeBaseMsat: inboundFee.BaseFee,
InboundFeeRateMilliMsat: inboundFee.FeeRate,
CustomRecords: customRecords,
},
AdvertisingNode: encodeKey(channelUpdate.AdvertisingNode),
ConnectingNode: encodeKey(channelUpdate.ConnectingNode),