Fix lock order inversion in promoteStakeContendersToTip
Summary:
Scheduler thread calls:
updatedBlockTip: cs_peerManager -> cs_main
promoteStakeContendersToTip: cs_stakeContendercache -> cs_peerManager
But main thread is calling addStakeContender: cs_main -> cs_stakeContenderCache
Swapping the lock order in promoteStakeContendersToTip fixes TSAN
Test Plan:
cmake -GNinja .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZERS=thread ninja check-avalanche-processor_tests
Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D17058