Page MenuHomePhabricator

rest: reduce LOCK(cs_main) scope in rest_block
ClosedPublic

Authored by PiRK on Jan 24 2023, 16:32.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABCae8564750efc: rest: reduce LOCK(cs_main) scope in rest_block
Summary

After commit ccd8ef6 (D2979) it is no longer required to hold cs_main when calling ReadBlockFromDisk.

The first commit moves ReadBlockFromDisk outside the lock scope in rest_block, where we can see a huge performance improvement when fetching blocks with multiple threads.

This is a partial backport of core#26308
https://github.com/bitcoin/bitcoin/pull/26308/commits/c75e3d2772b00acc3850f72a8cb733a0345aa773

Test Plan

With Clang and DEBUG:
ninja all check-all