Commit graph

2 commits

Author SHA1 Message Date
Oliver Gugger
dccea8feba multi: use new v2 modules everywhere 2026-05-14 18:05:33 -07:00
Or Aharonee
08be37f3b6
server, integration: add unit regression tests for peer lifecycle fix
Address review feedback on the peer add/done race fix:

Add three direct unit tests in server_test.go that exercise the fix
without the full server or rpctest harness:

- TestOnVerAckDoubleCall: call OnVerAck twice on the same serverPeer,
  assert no panic and verAckCh remains closed.
- TestPeerLifecycleOrdering: verack before disconnect emits peerAdd
  then peerDone in order.
- TestPeerLifecycleSimultaneousReady: both verAckCh and Peer.Done()
  ready before the handler runs; assert peerDone always arrives and
  peerAdd, if emitted, precedes it (100 iterations).

Harden integration tests in sync_race_test.go:

- Check fakePeerConn errors via require.NoError instead of discarding.
- Extract dialAndSendVersion helper for TestPreVerackDisconnect;
  check all errors instead of silently continuing.
- Fix comment wording ("produces" -> "is expected to produce").
2026-04-09 18:19:15 +03:00