skip empty routing events in routing tab

pull/113/head
Slyghtning 4 weeks ago
parent 81fe9bc285
commit ff6fb4becf
No known key found for this signature in database
GPG Key ID: F82D456EA023C9BF

@ -34,7 +34,10 @@ type RoutingEvent struct {
} }
func (u *RoutingEvent) Equals(other *RoutingEvent) bool { func (u *RoutingEvent) Equals(other *RoutingEvent) bool {
return u.IncomingChannelId == other.IncomingChannelId && u.IncomingHtlcId == other.IncomingHtlcId && u.OutgoingChannelId == other.OutgoingChannelId && u.OutgoingHtlcId == other.OutgoingHtlcId return u.IncomingChannelId == other.IncomingChannelId &&
u.IncomingHtlcId == other.IncomingHtlcId &&
u.OutgoingChannelId == other.OutgoingChannelId &&
u.OutgoingHtlcId == other.OutgoingHtlcId
} }
func (u *RoutingEvent) Update(newer *RoutingEvent) { func (u *RoutingEvent) Update(newer *RoutingEvent) {
@ -43,3 +46,9 @@ func (u *RoutingEvent) Update(newer *RoutingEvent) {
u.FailureCode = newer.FailureCode u.FailureCode = newer.FailureCode
u.FailureDetail = newer.FailureDetail u.FailureDetail = newer.FailureDetail
} }
func (u *RoutingEvent) IsEmpty() bool {
return u.OutgoingChannelId == 0 &&
u.FeeMsat == 0 &&
u.AmountMsat == 0
}

@ -96,7 +96,9 @@ func (p *PubSub) routingUpdates(ctx context.Context, sub chan *events.Event) {
go func() { go func() {
for hu := range routingUpdates { for hu := range routingUpdates {
p.logger.Debug("receive htlcUpdate") p.logger.Debug("receive htlcUpdate")
sub <- events.NewWithData(events.RoutingEventUpdated, hu) if !hu.IsEmpty() {
sub <- events.NewWithData(events.RoutingEventUpdated, hu)
}
} }
p.wg.Done() p.wg.Done()
}() }()

Loading…
Cancel
Save