1
0
Fork 0
forked from lthn/blockchain

fixed a rare race condition in get_coinbase_hash_cached()

This commit is contained in:
sowle 2025-05-22 14:26:05 +03:00
parent 91cd6148e8
commit cebeebe730
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -213,7 +213,7 @@ namespace currency
{
// state has just been 0, now 1, we're calculating
std::shared_ptr<crypto::hash> ptr_h = std::make_shared<crypto::hash>(get_transaction_hash(bei.bl.miner_tx));
bei.m_cache_coinbase_id = ptr_h;
std::atomic_store(&bei.m_cache_coinbase_id, ptr_h);
bei.m_cache_coinbase_state.store(2);
return *ptr_h;
}