Skip to content

Commit 3c47ff7

Browse files
committed
lnd: fix listchannels rpc bug
In case the pending channel would confirm while we already restarted and the peer remained offline there was a race condition where we would not register the peer properly with the event store.
1 parent c52a6dd commit 3c47ff7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

rpcserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5007,7 +5007,7 @@ func createRPCOpenChannel(r *rpcServer, dbChannel *channeldb.OpenChannel,
50075007
info, err := r.server.chanEventStore.GetChanInfo(outpoint, peer)
50085008
switch err {
50095009
// If the store does not know about the channel, we just log it.
5010-
case chanfitness.ErrChannelNotFound:
5010+
case chanfitness.ErrChannelNotFound, chanfitness.ErrPeerNotFound:
50115011
rpcsLog.Infof("channel: %v not found by channel event store",
50125012
outpoint)
50135013

server.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,7 +4306,8 @@ func (s *server) notifyOpenChannelPeerEvent(op wire.OutPoint,
43064306
remotePub *btcec.PublicKey) error {
43074307

43084308
// Call newOpenChan to update the access manager's maps for this peer.
4309-
if err := s.peerAccessMan.newOpenChan(remotePub); err != nil {
4309+
err := s.peerAccessMan.newOpenChan(remotePub)
4310+
if err != nil && !errors.Is(err, ErrNoPeerScore) {
43104311
return err
43114312
}
43124313

@@ -4323,7 +4324,8 @@ func (s *server) notifyPendingOpenChannelPeerEvent(op wire.OutPoint,
43234324

43244325
// Call newPendingOpenChan to update the access manager's maps for this
43254326
// peer.
4326-
if err := s.peerAccessMan.newPendingOpenChan(remotePub); err != nil {
4327+
err := s.peerAccessMan.newPendingOpenChan(remotePub)
4328+
if err != nil && !errors.Is(err, ErrNoPeerScore) {
43274329
return err
43284330
}
43294331

0 commit comments

Comments
 (0)