htlcswitch: add test for deferred processing remote adds when quiescent

This commit is contained in:
Keagan McClelland
2024-04-09 17:48:56 -07:00
parent 4fbab45a5f
commit 5906ca2537
2 changed files with 99 additions and 2 deletions

View File

@@ -153,8 +153,10 @@ type mockServer struct {
t testing.TB
name string
messages chan lnwire.Message
name string
messages chan lnwire.Message
protocolTraceMtx sync.Mutex
protocolTrace []lnwire.Message
id [33]byte
htlcSwitch *Switch
@@ -289,6 +291,10 @@ func (s *mockServer) Start() error {
for {
select {
case msg := <-s.messages:
s.protocolTraceMtx.Lock()
s.protocolTrace = append(s.protocolTrace, msg)
s.protocolTraceMtx.Unlock()
var shouldSkip bool
for _, interceptor := range s.interceptorFuncs {
@@ -627,6 +633,8 @@ func (s *mockServer) readHandler(message lnwire.Message) error {
targetChan = msg.ChanID
case *lnwire.UpdateFee:
targetChan = msg.ChanID
case *lnwire.Stfu:
targetChan = msg.ChanID
default:
return fmt.Errorf("unknown message type: %T", msg)
}