mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-01 18:27:43 +02:00
watchtower: dont load closed channel details
In this commit, the FetchChanSummaries method is adapted to skip loading any channel summaries if the channel has been marked as closed.
This commit is contained in:
@@ -1284,7 +1284,8 @@ func (c *ClientDB) NumAckedUpdates(id *SessionID) (uint64, error) {
|
||||
}
|
||||
|
||||
// FetchChanSummaries loads a mapping from all registered channels to their
|
||||
// channel summaries.
|
||||
// channel summaries. Only the channels that have not yet been marked as closed
|
||||
// will be loaded.
|
||||
func (c *ClientDB) FetchChanSummaries() (ChannelSummaries, error) {
|
||||
var summaries map[lnwire.ChannelID]ClientChanSummary
|
||||
|
||||
@@ -1300,6 +1301,13 @@ func (c *ClientDB) FetchChanSummaries() (ChannelSummaries, error) {
|
||||
return ErrCorruptChanDetails
|
||||
}
|
||||
|
||||
// If this channel has already been marked as closed,
|
||||
// then its summary does not need to be loaded.
|
||||
closedHeight := chanDetails.Get(cChanClosedHeight)
|
||||
if len(closedHeight) > 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var chanID lnwire.ChannelID
|
||||
copy(chanID[:], k)
|
||||
|
||||
|
Reference in New Issue
Block a user