Commit f92dc65
committed
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. #20749 (comment)
2. #19806 (comment)
3. #19806 (comment)
4. #19806 (comment)1 parent e130ff3 commit f92dc65
2 files changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5143 | 5143 | | |
5144 | 5144 | | |
5145 | 5145 | | |
| 5146 | + | |
5146 | 5147 | | |
5147 | 5148 | | |
5148 | 5149 | | |
| |||
5189 | 5190 | | |
5190 | 5191 | | |
5191 | 5192 | | |
| 5193 | + | |
5192 | 5194 | | |
5193 | 5195 | | |
5194 | 5196 | | |
5195 | 5197 | | |
5196 | 5198 | | |
5197 | 5199 | | |
5198 | | - | |
| 5200 | + | |
5199 | 5201 | | |
5200 | 5202 | | |
5201 | 5203 | | |
| |||
5226 | 5228 | | |
5227 | 5229 | | |
5228 | 5230 | | |
5229 | | - | |
| 5231 | + | |
| 5232 | + | |
| 5233 | + | |
| 5234 | + | |
5230 | 5235 | | |
5231 | 5236 | | |
5232 | 5237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
820 | | - | |
| 820 | + | |
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
| |||
0 commit comments