Page MenuHomePhabricator

rpc: Tidy up local references (see commit message)
ClosedPublic

Authored by PiRK on Jun 8 2022, 15:27.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC77cb6d193123: rpc: Tidy up local references (see commit message)
Summary

Organize local variables/references such that:

  1. There is always a ChainstateManager reference before any LOCK(cs_main).
  2. NodeContext references are used with Ensure*() functions introduced in previous commit where appropriate to avoid duplicate assertions.

This is a backport of core#21391 [12/14]
https://github.com/bitcoin/bitcoin/pull/21391/commits/6a3d1920209cded0dae52fb9070a3530d9a4e5fd

Depends on D11586

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.Jun 8 2022, 15:27
Fabien requested changes to this revision.Jun 9 2022, 15:09
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/rpc/blockchain.cpp
1652 ↗(On Diff #33896)

This doesn't need the lock either

src/rpc/rawtransaction.cpp
1166 ↗(On Diff #33896)

Use the WITH_LOCK macro to avoid nesting

This revision now requires changes to proceed.Jun 9 2022, 15:09

use WITH_LOCK macro, move config.GetChainParams() before the lock

This revision is now accepted and ready to land.Jun 9 2022, 16:15