funding: fix bug that double counts "pending channels" in GetInfo
This commit fixes a bug that double counts the number of pending channels in GetInfo. Previously we weren’t yet storing the pending channels on disk, we are now but comparing both the disk channel and the channels within memory leads us to double count channels. To fix this, we now only count the database channels. Note that this NumPendingChannels method can now be removed as it’s no longer needed.
This commit is contained in:
parent
17c5deb369
commit
20bbe1e12d
@ -406,11 +406,7 @@ func (f *fundingManager) reservationCoordinator() {
|
||||
|
||||
// handleNumPending handles a request for the total number of pending channels.
|
||||
func (f *fundingManager) handleNumPending(msg *numPendingReq) {
|
||||
var numPending uint32
|
||||
for _, peerChannels := range f.activeReservations {
|
||||
numPending += uint32(len(peerChannels))
|
||||
}
|
||||
|
||||
// TODO(roasbeef): remove this method?
|
||||
dbPendingChannels, err := f.cfg.Wallet.ChannelDB.FetchPendingChannels()
|
||||
if err != nil {
|
||||
close(msg.resp)
|
||||
@ -418,9 +414,7 @@ func (f *fundingManager) handleNumPending(msg *numPendingReq) {
|
||||
return
|
||||
}
|
||||
|
||||
numPending = numPending + uint32(len(dbPendingChannels))
|
||||
|
||||
msg.resp <- numPending
|
||||
msg.resp <- uint32(len(dbPendingChannels))
|
||||
msg.err <- nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user