|
Ran
|
Files
700
|
Run time
20s
|
Badge
README BADGES
|
push
github
feat: improve header sync (#7421) Description --- When we have a valid PoW equal to or higher than what we have or what has been advertised by the sync peer, we need to commit the headers, so any downstream block sync error does not invalidate the headers that have been downloaded. _**Edit:** When block sync fails, we also make sure to swap to the best PoW chain, also preserving banked headers if we do not need to reorg._ Closes #7342 Motivation and Context --- See #7342 How Has This Been Tested? --- System-level tests passed: - Synching a previously synced node, a couple of days old. - Syncing from scratch, encountering multiple block-sync failures, but using the good PoW headers already banked. ```rust 51952: 2025-08-18 16:07:02.097680100 [c::bn::block_sync] DEBUG Validating block body #22624 (PoW = RandomXTari, input(s): 1, output(s): 54, kernel(s): 2, latency: 108.00µs) 51961: 2025-08-18 16:07:02.111648900 [c::bn::block_sync] DEBUG Validated in 14ms. Storing block body #22624 (PoW = RandomXTari, input(s): 1, output(s): 54, kernel(s): 2) 51962: 2025-08-18 16:07:02.111668100 [c::bn::block_sync] TRACE Hash: <a class=hub.com/tari-project/tari/commit/91a1fbccc1f94e2aa93b6efdaf9c3fbf16d0588c">91a1fbccc<a href="https://github.com/tari-project/tari/commit/84c81d129edc8d90adeec2eed2e207a61b44bef4">3458b7ef444e605f62375077 54024: 2025-08-18 16:11:06.389482300 [c::bn::block_sync] WARN Peer did not supply all the blocks they claimed they had: Their claim - height: 74721, accumulated difficulty: <a class="double-link" href="https://github.com/tari-project/tari/commit/4089235547434023187024157117581153168163">408923554</a><a href="https://github.com/tari-project/tari/commit/84c81d129edc8d90adeec2eed2e207a61b44bef4">715651441378. Our status after block sync - height: 22624, accumulated difficulty: </a><a class="double-link" href="https://github.com/tari-project/tari/commit/1547640955349056263010512134240412613668">154764095</a><a href="https://github.com/tari-project/tari/commit/84c81d129edc8d90adeec2eed2e207a61b44bef4">889130919000 54028: 2025-08-18 16:11:06.390047900 [c::bn::block_sync] WARN Block sync failed - best header: 74723/1bcf293971df2d6c888a6589dca3a323b, best block: 22624/91a1fbccc1f94e2aa93b6efdaf9c3fbf16d0588c3458b7ef444e605f62375077. No more sync peers available: Block sync failed 54109: 2025-08-18 16:11:11.596105400 [c::bn::header_sync] DEBUG Starting header sync. 54110: 2025-08-18 16:11:11.59617... (continued)
72705 of 118983 relevant lines covered (61.11%)
229424.73 hits per line
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|