htlcswitch/mock: drop messages if link is not online
In this commit, we modify the readHandler w/in the mock peer to drop messages if it is unable to find the target link. This has led to observed race conditions related to removing a link and still attempting to deliver messages. By removing this, the readHandler shouldn't fail the test as a result.
This commit is contained in:
parent
f636ff8b4a
commit
53b58a1eb3
@ -500,11 +500,12 @@ func (s *mockServer) readHandler(message lnwire.Message) error {
|
|||||||
return fmt.Errorf("unknown message type: %T", msg)
|
return fmt.Errorf("unknown message type: %T", msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch the commitment update message to the proper
|
// Dispatch the commitment update message to the proper channel link
|
||||||
// channel link dedicated to this channel.
|
// dedicated to this channel. If the link is not found, we will discard
|
||||||
|
// the message.
|
||||||
link, err := s.htlcSwitch.GetLink(targetChan)
|
link, err := s.htlcSwitch.GetLink(targetChan)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create goroutine for this, in order to be able to properly stop
|
// Create goroutine for this, in order to be able to properly stop
|
||||||
|
Loading…
Reference in New Issue
Block a user