Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #2233: [test] fix miner_tests block generation race condition.
f12bd4c test: fix miner_tests block generation race condition. (furszy) Pull request description: Took a while to understand the UB.. but this should fix it. Based on the results thrown by #2220. As we are "faking" the block creation based on the same `CBlock` shared_ptr and the pointer is shared across multiple threads, there is a possible race condition with the scheduler thread when we clear the transactions vector to add the new coinbase transaction for the next "new" block. If the secondary thread is not fast enough, as we are doing all in the same loop non-stop, the scheduler thread could try to access to the block ptr vtx a millisecond later when there is no transactions, causing the UB due the vector brackets operator access on an empty container. ACKs for top commit: Fuzzbawls: utACK f12bd4c random-zebra: utACK f12bd4c and merging... Tree-SHA512: 7124534e07226337a7c8a9198a3b199f7c5305b1ec0f203bfe66394d1c341f41f53ed53abf2abfca7d71fa452b044e7ac91c0a29e0bf431bbc60ca1c5730fb9f
- Loading branch information