Commit 3a83d44
committed
Merge bitcoin/bitcoin#27720: index: prevent race by calling 'CustomInit' prior setting 'synced' flag
3126454 index: prevent race by calling 'CustomInit' prior setting 'synced' flag (furszy)
Pull request description:
Decoupled from #27607.
Fixed a potential race condition in master (not possible so far) that could become an actual issue soon.
Where the index's `CustomAppend` method could be called (from `BlockConnected`) before its
`CustomInit` method, causing the index to try to update itself before it is initialized.
This could happen because we set the index `m_synced` flag (which enables `BlockConnected` events)
before calling to the child class init function (`CustomInit`). So, for example, the block filter index could
process a block before initialize the next filter position field and end up overwriting the first stored filter.
This race was introduced in bitcoin/bitcoin@bef4e40 from bitcoin/bitcoin#25494.
ACKs for top commit:
achow101:
ACK 3126454
mzumsande:
Code review ACK 3126454
TheCharlatan:
Nice, ACK 3126454
Tree-SHA512: 7a53fed1d2035cb4c1f331d6ee9f92d499b6cbb618ea534c6440f5a45ff9b3ac4dcff5fb4b88937f45a0be249e3a9c6dc6c3ac77180f12ae25fc56856ba397351 file changed
+15
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 106 | | |
112 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
113 | 110 | | |
114 | | - | |
| 111 | + | |
115 | 112 | | |
116 | 113 | | |
117 | 114 | | |
118 | 115 | | |
119 | 116 | | |
120 | 117 | | |
121 | 118 | | |
122 | | - | |
| 119 | + | |
123 | 120 | | |
124 | 121 | | |
125 | 122 | | |
| |||
143 | 140 | | |
144 | 141 | | |
145 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
| |||
408 | 415 | | |
409 | 416 | | |
410 | 417 | | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | 418 | | |
417 | 419 | | |
418 | 420 | | |
| |||
0 commit comments