Merge pull request #1963 from wpaulino/create-chan-buckets-once

channeldb: ensure channel buckets are only created once
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2018-09-28 17:06:39 -07:00
commit 13802b4218
4 files changed
+64 -96

No files matched your search

+9 -7
View File
@@ -2844,8 +2844,6 @@ func (s *server) announceChanStatus(op wire.OutPoint, disabled bool) error {
return nil
}
srvrLog.Debugf("Announcing channel(%v) disabled=%v", op, disabled)
// Retrieve the latest update for this channel. We'll use this
// as our starting point to send the new update.
chanUpdate, err := s.fetchLastChanUpdateByOutPoint(op)
@@ -2885,6 +2883,8 @@ func (s *server) announceChanStatus(op wire.OutPoint, disabled bool) error {
return err
}
srvrLog.Debugf("Announcing channel(%v) disabled=%v", op, disabled)
// Once signed, we'll send the new update to all of our peers.
if err := s.applyChannelUpdate(chanUpdate); err != nil {
return err
@@ -3050,8 +3050,8 @@ func (s *server) watchChannelStatus() {
newStatus := make(map[wire.OutPoint]activeStatus)
for _, c := range channels {
// We'll skip any private channels, as they
// aren't used for routing within the network
// by other nodes.
// aren't used for routing within the network by
// other nodes.
if c.ChannelFlags&lnwire.FFAnnounceChannel == 0 {
continue
}
@@ -3110,10 +3110,12 @@ func (s *server) watchChannelStatus() {
delete(status, op)
err = s.announceChanStatus(op, disable)
if err != nil {
if err != nil &&
err != channeldb.ErrEdgeNotFound {
srvrLog.Errorf("Unable to "+
"disable channel: %v",
err)
"disable channel %v: %v",
op, err)
}
}
}