reconsiderOrphans was accessing pool state without the pool mutex held, which
results in data races.
To resolve this, some refactoring is necessary. reconsiderOrphans calls
acceptKE, which did acquire the mutex, so that needs to be hoisted out.
In this commit, the pre-mutex-acquire sanity checks for PR and KE messages in
acceptPR and acceptKE are moved to separate checkAccept{PR,KE} functions for
the caller, who then becomes responsible for acquiring the mutex. After
acceptPR/acceptKE return, reconsiderOrphans is then called with the mutex
still held.
reconsiderOrphans was accessing pool state without the pool mutex held, which results in data races.
To resolve this, some refactoring is necessary. reconsiderOrphans calls acceptKE, which did acquire the mutex, so that needs to be hoisted out.
In this commit, the pre-mutex-acquire sanity checks for PR and KE messages in acceptPR and acceptKE are moved to separate checkAccept{PR,KE} functions for the caller, who then becomes responsible for acquiring the mutex. After acceptPR/acceptKE return, reconsiderOrphans is then called with the mutex still held.
This is a backport candidate for 2.0.1.