multi: extend lnpeer.Peer interface with Disconnect function

This will be used in the gossiper to disconnect from peers if their
ban score passes the ban threshold.
This commit is contained in:
Eugene Siegel
2024-08-14 14:03:39 -04:00
parent 0173e4c44d
commit 99b86ba462
8 changed files with 78 additions and 30 deletions

View File

@@ -2,6 +2,7 @@ package discovery
import (
"fmt"
"sync/atomic"
"testing"
"time"
@@ -74,7 +75,7 @@ func TestReliableSenderFlow(t *testing.T) {
// Create a mock peer to send the messages to.
pubKey := randPubKey(t)
msgsSent := make(chan lnwire.Message)
peer := &mockPeer{pubKey, msgsSent, reliableSender.quit}
peer := &mockPeer{pubKey, msgsSent, reliableSender.quit, atomic.Bool{}}
// Override NotifyWhenOnline and NotifyWhenOffline to provide the
// notification channels so that we can control when notifications get
@@ -193,7 +194,7 @@ func TestReliableSenderStaleMessages(t *testing.T) {
// Create a mock peer to send the messages to.
pubKey := randPubKey(t)
msgsSent := make(chan lnwire.Message)
peer := &mockPeer{pubKey, msgsSent, reliableSender.quit}
peer := &mockPeer{pubKey, msgsSent, reliableSender.quit, atomic.Bool{}}
// Override NotifyWhenOnline to provide the notification channel so that
// we can control when notifications get dispatched.