Page MenuHomePhabricator

Merge #11041: Add LookupBlockIndex

Authored by jasonbcox on Apr 10 2019, 17:46.



92fabcd44 Add LookupBlockIndex function (João Barbosa)
43a32b739 Add missing cs_lock in CreateWalletFromFile (João Barbosa)
f814a3e8f Fix cs_main lock in LoadExternalBlockFile (João Barbosa)
c651df8b3 Lock cs_main while loading block index in AppInitMain (João Barbosa)
02de6a6bc Assert cs_main is held when accessing mapBlockIndex (João Barbosa)

Pull request description:

Replace all `mapBlockIndex` lookups with the new `LookupBlockIndex()`. In some cases it avoids a second lookup.

Tree-SHA512: ca31118f028a19721f2191d86f2dd398144d04df345694575a64aeb293be2f85785201480c3c578a0ec99690516205708558c0fd4168b09313378fd4e60a8412

Backport of Core PR 11041
Completes T560
Depends on D1971, D2801

Note to reviewers: LookupBlockIndex was moved from validation.h to chain.h to prevent unnecessary inclusions of validation.h in various files.

Test Plan
make check

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jasonbcox created this revision.Apr 10 2019, 17:46
Herald added a reviewer: Restricted Project. · View Herald TranscriptApr 10 2019, 17:46
jasonbcox added inline comments.Apr 10 2019, 17:48
10 ↗(On Diff #8025)

Re-adding here since it was removed in D712

16 ↗(On Diff #8025)

Adding this for BlockMap typedef, which was moved to chain.h in D712

deadalnix requested changes to this revision.Apr 10 2019, 21:59
deadalnix added inline comments.
10 ↗(On Diff #8025)

Including a giant header that define half the world for just one function is a good sign that function isn't where it should be.

16 ↗(On Diff #8025)

That was the second sign.

626 ↗(On Diff #8025)

This very clearly belongs into chain.h

This revision now requires changes to proceed.Apr 10 2019, 21:59
jasonbcox updated this revision to Diff 8031.Apr 10 2019, 23:31

Move LookupBlockIndex definition to chain.h

jasonbcox edited the summary of this revision. (Show Details)Apr 10 2019, 23:32
Fabien requested changes to this revision.Apr 12 2019, 06:16
Fabien added inline comments.
183 ↗(On Diff #8031)

This line is not in the original PR, it is removed in PR11838

This revision now requires changes to proceed.Apr 12 2019, 06:16
jasonbcox updated this revision to Diff 8047.Apr 13 2019, 16:08

Fix dependency + rebase

deadalnix accepted this revision.Apr 14 2019, 17:11
deadalnix added inline comments.
2189 ↗(On Diff #8047)

ut everything in one string and let clang-format do its magic.

jasonbcox updated this revision to Diff 8052.Apr 14 2019, 17:20

Fix string linting + rebase

Fabien accepted this revision.Apr 15 2019, 07:48
This revision is now accepted and ready to land.Apr 15 2019, 07:48
This revision was automatically updated to reflect the committed changes.