ui/models: GetChannelInfo

pull/1/head
Edouard Paris 5 years ago
parent 578d113902
commit e853349da2

@ -56,8 +56,8 @@ func (c *Channels) Update(newChannel *models.Channel) {
oldChannel.Private = newChannel.Private
oldChannel.PendingHTLC = newChannel.PendingHTLC
if newChannel.LastUpdated != nil {
oldChannel.LastUpdated = newChannel.LastUpdated
if newChannel.LastUpdate != nil {
oldChannel.LastUpdate = newChannel.LastUpdate
}
}

@ -48,12 +48,16 @@ func (m *Models) RefreshChannels(ctx context.Context) error {
for i := range channels {
if !m.Channels.Contains(channels[i]) {
m.Channels.Add(channels[i])
continue
}
channel := m.Channels.GetByID(channels[i].ID)
if channel != nil &&
(channel.UpdatesCount < channels[i].UpdatesCount ||
channel.LastUpdated == nil) {
channel.LastUpdate == nil) {
err := m.App.Network.GetChannelInfo(ctx, channels[i])
if err != nil {
return err
}
m.Channels.Update(channels[i])
}
}

Loading…
Cancel
Save