Page MenuHomePhabricator

Merge #11041: Add LookupBlockIndex
ClosedPublic

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

Details

Summary

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
https://github.com/bitcoin/bitcoin/pull/11041/files
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
test_runner.py

Diff Detail

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

Event Timeline

src/checkpoints.cpp
10 ↗(On Diff #8025)

Re-adding here since it was removed in D712

src/validation.h
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.
src/checkpoints.cpp
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.

src/validation.h
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

Move LookupBlockIndex definition to chain.h

Fabien requested changes to this revision.Apr 12 2019, 06:16
Fabien added inline comments.
src/rpc/rawtransaction.cpp
183 ↗(On Diff #8031)

This line is not in the original PR, it is removed in PR11838
https://github.com/bitcoin/bitcoin/pull/11838/files

This revision now requires changes to proceed.Apr 12 2019, 06:16
deadalnix added inline comments.
src/init.cpp
2189 ↗(On Diff #8047)

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

Fix string linting + rebase

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