Repository navigation
Commit d635993
validation: check invariants when inserting into m_blocks_unlinked
For an entry A -> B in m_blocks_unlinked, the entry B was added into
m_blocks_unlinked either because:
- some ancestor of B was never received (or)
- some ancestor of B was pruned away.
Every insert must satisfy two invariants:
1. B has BLOCK_HAVE_DATA set.
2. No duplicate A -> B entries in m_blocks_unlinked (this is UB zone if
this entry gets popped twice in ReceivedBlockTransactions and
happens to be in setBlockIndexCandidates)
2 bugs (#35070 and #35168) discovered recently stemmed from the
m_blocks_unlinked insertion sites not enforcing these invariants.
So add a helper which wraps around insertion sites of m_blocks_unlinked
with these invariants.
Co-authored-by: Martin Zumsande <[email protected]>1 parent 0852925 commit d635993
3 files changed
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
258 | 270 | | |
259 | 271 | | |
260 | 272 | | |
| |||
487 | 499 | | |
488 | 500 | | |
489 | 501 | | |
490 | | - | |
| 502 | + | |
491 | 503 | | |
492 | 504 | | |
493 | 505 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3149 | 3149 | | |
3150 | 3150 | | |
3151 | 3151 | | |
3152 | | - | |
3153 | | - | |
3154 | | - | |
3155 | | - | |
| 3152 | + | |
3156 | 3153 | | |
3157 | 3154 | | |
3158 | 3155 | | |
| |||
3816 | 3813 | | |
3817 | 3814 | | |
3818 | 3815 | | |
3819 | | - | |
| 3816 | + | |
3820 | 3817 | | |
3821 | 3818 | | |
3822 | 3819 | | |
| |||
0 commit comments