iroha
iroha copied to clipboard
Consider simplifying pattern for waiting for empty block in tests
Is there a good way to avoid this repeating pattern? At least for the block immediately following the genesis block, I think
NetworkBuilder::start_blockingcould imply that commit
Pattern:
// Waiting for empty block to be committed
std::thread::sleep(network.pipeline_time());
See https://github.com/hyperledger-iroha/iroha/pull/5320/commits/6fb19964009c2133c80457e0e30d6b36d7d9f7f8
Originally posted by @s8sato in https://github.com/hyperledger-iroha/iroha/pull/5320#discussion_r1971149320
NetworkPeer already provides a precise API exactly for this case: events, once, and once_block. For example:
https://github.com/hyperledger-iroha/iroha/blob/84c117a62983ec7c771353e90eac1f4c6da7edf9/crates/iroha/tests/extra_functional/restart_peer.rs#L44-L47