mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-08 20:28:04 +02:00
rpcserver: fix nil issue with historical channels [skip ci]
Fixes #5796. Some historical channels might not have the forwarding packages recorded. And since the error might be silenced, the historical channel might be nil.
This commit is contained in:
parent
be2566cf26
commit
e067dc73b7
22
rpcserver.go
22
rpcserver.go
@ -3233,23 +3233,23 @@ func (r *rpcServer) PendingChannels(ctx context.Context,
|
||||
historical.ChanType,
|
||||
)
|
||||
|
||||
// Get the number of forwarding packages from the
|
||||
// historical channel.
|
||||
fwdPkgs, err := historical.LoadFwdPkgs()
|
||||
if err != nil {
|
||||
rpcsLog.Errorf("unable to load forwarding "+
|
||||
"packages for channel:%s, %v",
|
||||
historical.ShortChannelID, err)
|
||||
return nil, err
|
||||
}
|
||||
channel.NumForwardingPackages = int64(len(fwdPkgs))
|
||||
|
||||
// If the error is non-nil, and not due to older versions of lnd
|
||||
// not persisting historical channels, return it.
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get the number of forwarding packages from the historical
|
||||
// channel.
|
||||
fwdPkgs, err := historical.LoadFwdPkgs()
|
||||
if err != nil {
|
||||
rpcsLog.Errorf("unable to load forwarding packages "+
|
||||
"for channel:%s, %v",
|
||||
historical.ShortChannelID, err)
|
||||
return nil, err
|
||||
}
|
||||
channel.NumForwardingPackages = int64(len(fwdPkgs))
|
||||
|
||||
closeTXID := pendingClose.ClosingTXID.String()
|
||||
|
||||
switch pendingClose.CloseType {
|
||||
|
Loading…
x
Reference in New Issue
Block a user