Repository navigation
Commit c787b3b
validation: avoid duplicates in m_blocks_unlinked
In a pruned node undergoing a deep reorg, FindMostWorkChain can
insert duplicate entries into m_blocks_unlinked.
This can happen when:
- Traversing from one candidate tip to the fork point adds blocks
whose parents have been pruned.
- Traversing from another candidate tip over the same fork inserts
the same pairs again, since the blocks are shared across
both branches.
When we finally download the missing parent from our peer and call
ReceivedBlockTransactions to process m_blocks_unlinked, the same
entry may be processed multiple times.
This can lead to re-insertion into setBlockIndexCandidates with
a modified nSequenceId, violating its ordering invariants and
causing undefined behavior. So avoid duplicate insertions into
m_blocks_unlinked here.
Co-authored-by: Martin Zumsande <[email protected]>1 parent e0fb41f commit c787b3b
1 file changed
Lines changed: 15 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3141 | 3141 | | |
3142 | 3142 | | |
3143 | 3143 | | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
3144 | 3147 | | |
3145 | | - | |
3146 | | - | |
3147 | | - | |
3148 | | - | |
3149 | | - | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
3150 | 3156 | | |
3151 | 3157 | | |
3152 | 3158 | | |
| |||
5340 | 5346 | | |
5341 | 5347 | | |
5342 | 5348 | | |
5343 | | - | |
5344 | | - | |
5345 | | - | |
| 5349 | + | |
| 5350 | + | |
| 5351 | + | |
| 5352 | + | |
5346 | 5353 | | |
5347 | | - | |
5348 | 5354 | | |
5349 | | - | |
5350 | 5355 | | |
5351 | 5356 | | |
5352 | 5357 | | |
| |||
0 commit comments