peer: Ensure listener tests sync with messages.

This adds an additional read from the ok channel in the peer listener
tests to ensure the version message is consumed as well as the verack so
that the remaining tests line up with the messages that are being tested.
This commit is contained in:
Dave Collins 2019-09-02 03:02:25 -05:00
parent 2d09391768
commit fefb993956
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2

View File

@ -426,11 +426,18 @@ func TestPeerListeners(t *testing.T) {
select {
case <-verack:
case <-time.After(time.Second * 1):
t.Errorf("TestPeerListeners: verack timeout\n")
t.Error("TestPeerListeners: verack timeout\n")
return
}
}
select {
case <-ok:
case <-time.After(time.Second * 1):
t.Error("TestPeerListeners: version timeout")
return
}
tests := []struct {
listener string
msg wire.Message