HomePhabricator

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

Description

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

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

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D12475

Details

Provenance
Sebastian Falbesoner <sebastian.falbesoner@gmail.com>Authored on Feb 27 2021, 17:32
FabienCommitted on Nov 12 2022, 12:46
FabienPushed on Nov 12 2022, 12:46
Reviewer
Restricted Project
Differential Revision
D12475: zmq test: fix sync-up by matching notification to generated block
Parents
rABCd4bc7d6d3141: validation, log: improve logging of ChainstateManager snapshot persistance
Branches
Unknown
Tags
Unknown