Page MenuHomePhabricator

Require IsBlockPruned() to hold mutex cs_main
ClosedPublic

Authored by PiRK on Jan 24 2023, 07:19.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCbd5235a5a860: Require IsBlockPruned() to hold mutex cs_main
Summary

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

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

Depends on D13036

Test Plan

With clang and DEBUG:

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jan 24 2023, 07:19
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/rpc/blockchain.cpp
177 ↗(On Diff #37655)

You should move the call to UndoReadFromDisk out of the lock, because it creates recursive locking.
cs_main is a recursive lock so this is not an actual issue but better avoid double locks if possible. Not blocking on this because it's not wrong, but can you please check if it's been done by core and eventually backport the change as a follow up ?

1077 ↗(On Diff #37655)

Do you need the lock for this one ?

1097 ↗(On Diff #37655)

dito

This revision is now accepted and ready to land.Jan 24 2023, 08:55
src/rpc/blockchain.cpp
177 ↗(On Diff #37655)

Good remark. It is fixed in core#26308

1077 ↗(On Diff #37655)