aboutsummaryrefslogtreecommitdiff
path: root/src/test/crypto_tests.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-01-27 16:20:59 -0500
committerCarl Dong <contact@carldong.me>2021-01-28 14:14:22 -0500
commitf92dc6557a153b390a1ae1d0808ff7ed5d02c66e (patch)
treed8f634761b2bd2a792847625776aa24fc12fd136 /src/test/crypto_tests.cpp
parente130ff38c91ad3527924e6195325f6ae7ce5d77c (diff)
validation: Guard the active_chainstate with cs_main
This avoids a potential race-condition where a thread is reading the ChainstateManager::m_active_chainstate pointer while another one is writing to it. There is no portable guarantee that reading/writing the pointer is thread-safe. This is also done in way that mimics ::ChainstateActive(), so the transition from that function to this method is easy. More discussion: 1. https://github.com/bitcoin/bitcoin/pull/20749#discussion_r559544027 2. https://github.com/bitcoin/bitcoin/pull/19806#discussion_r561023961 3. https://github.com/bitcoin/bitcoin/pull/19806#issuecomment-768946522 4. https://github.com/bitcoin/bitcoin/pull/19806#issuecomment-768955695
Diffstat (limited to 'src/test/crypto_tests.cpp')
0 files changed, 0 insertions, 0 deletions