Page MenuHomePhabricator

zmq test: fix sync-up by matching notification to generated block
ClosedPublic

Authored by Fabien on Nov 11 2022, 10:56.

Details

Summary
It turned out that the "sync up" procedure of repeatedly generating a block and waiting for a notification once with timeout is too naive in
its current form, as the following scenario could happen:
    - generate block A
    - receive notification, timeout happens -> repeat procedure
    - generate block B
    - node publishes block A notification
    - receive notification, we receive the one caused by block A
      -> sync-up procedure is completed
    - node publishes block B
    - the actual test starts
    - on the first notification reception, one caused by block B is received,
      rather than the one actually caused by test code, leading to failure

This change ensures that after each test block generation, we wait for the notification that is actually caused by that block and ignore others
from possibly earlier blocks.

Backport of core#21310.

Test Plan
./test/functional/test_runner.py interface_zmq

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable