diff --git a/ui/models/channels.go b/ui/models/channels.go index 93dc9d4..b26ad5c 100644 --- a/ui/models/channels.go +++ b/ui/models/channels.go @@ -104,6 +104,7 @@ func (c *Channels) Update(newChannel *models.Channel) { oldChannel.CSVDelay = newChannel.CSVDelay oldChannel.Private = newChannel.Private oldChannel.PendingHTLC = newChannel.PendingHTLC + oldChannel.Age = newChannel.Age if newChannel.LastUpdate != nil { oldChannel.LastUpdate = newChannel.LastUpdate diff --git a/ui/models/models.go b/ui/models/models.go index 910966e..e606f73 100644 --- a/ui/models/models.go +++ b/ui/models/models.go @@ -55,6 +55,9 @@ func (m *Models) RefreshChannels(ctx context.Context) error { index := map[string]*models.Channel{} for i := range channels { index[channels[i].ChannelPoint] = channels[i] + if channels[i].ID > 0 { + channels[i].Age = m.Info.BlockHeight - uint32(channels[i].ID>>40) + } if !m.Channels.Contains(channels[i]) { m.Channels.Add(channels[i]) } @@ -62,9 +65,6 @@ func (m *Models) RefreshChannels(ctx context.Context) error { if channel != nil && (channel.UpdatesCount < channels[i].UpdatesCount || channel.LastUpdate == nil || channel.LocalPolicy == nil || channel.RemotePolicy == nil) { - if channels[i].ID > 0 { - channels[i].Age = m.Info.BlockHeight - uint32(channels[i].ID>>40) - } err := m.network.GetChannelInfo(ctx, channels[i]) if err != nil { return err