Page MenuHomePhabricator

Fix race condition in avalanche test
ClosedPublic

Authored by deadalnix on Apr 12 2020, 15:58.

Details

Summary

As it turns out, self.last_message and the call to on_mesage is not an atomic operation (it cannot be) and it is possible to bail out of the wait-for function before they are called.

By checking the result of the on_messages function instead, this is not possible. It also makes the code simpler, because we don't need to check for the None case anymore, nor do we need to ping.

Test Plan

Ran the test 100 time in a row in regular and debug mode.

Diff Detail

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