HomePhabricator

rest: reduce LOCK(cs_main) scope in rest_block

Description

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

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Subscribers: sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D13052

Details

Provenance
Andrew Toth <andrewstoth@gmail.com>Authored on Oct 13 2022, 19:19
PiRKCommitted on Jan 25 2023, 07:18
PiRKPushed on Jan 25 2023, 07:19
Reviewer
Restricted Project
Differential Revision
D13052: rest: reduce LOCK(cs_main) scope in rest_block
Parents
rABC964a64e6311a: [avalanche] Add field to the getavalancheinfo RPC to monitor if our proof is…
Branches
Unknown
Tags
Unknown