Skip to content

Conversation

ajtowns
Copy link
Contributor

@ajtowns ajtowns commented Mar 17, 2022

Gives ChainstateManager a reference to the CChainParams its working on, and simplifies some of the functions that would otherwise take that as a parameter. Removes the g_versionbitscache global by moving it into ChainstateManager.

@dongcarl
Copy link
Contributor

Concept ACK!

Also wanted to note that in one of my branches for libbitcoinkernel I give ChainstateManager a CChainParams as well, so it definitely makes sense!

@ajtowns ajtowns force-pushed the 202202-cchainparams-chainstatemanager branch from 3b93ef1 to 1724029 Compare March 17, 2022 03:55
@ajtowns ajtowns force-pushed the 202202-cchainparams-chainstatemanager branch from 1724029 to 88b14a6 Compare March 17, 2022 20:29
@ajtowns ajtowns changed the title WIP remove g_versionbitscache global WIP: deploymentstatus: move g_versionbitscache global to ChainstateManager Mar 17, 2022
@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 19, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25073 (test: Cleanup miner_tests by MarcoFalke)
  • #25064 ([kernel 2b/n] Add ChainstateManager::m_adjusted_time_callback by dongcarl)
  • #24737 (Remove taproot chain param by MarcoFalke)
  • #24571 (p2p: Prevent block index fingerprinting by sending additional getheaders messages by dergoegge)
  • #24565 (Remove LOCKTIME_MEDIAN_TIME_PAST constant by MarcoFalke)
  • #24232 (assumeutxo: add init and completion logic by jamesob)
  • #24008 (assumeutxo: net_processing changes by jamesob)
  • #20799 (net processing: Only support version 2 compact blocks by jnewbery)
  • #18933 (rpc: Add submit option to generateblock by MarcoFalke)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@ajtowns
Copy link
Contributor Author

ajtowns commented May 9, 2022

Rebased past #24538

EDIT: also tweaked validation.h to not directly include consensus/params.h as per #24595 (comment)

@ajtowns ajtowns force-pushed the 202202-cchainparams-chainstatemanager branch from 0f40460 to bb5c24b Compare May 10, 2022 02:12
@dongcarl
Copy link
Contributor

reACK bb5c24b

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review ACK bb5c24b 📙

Show signature

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

review ACK bb5c24b120a3ac7df367a1c5d9b075ca564efb5f 📙
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUi6+Qv8Dw67I3SBVnRjV/M10aNNkHAduz39CLI+zz2TwT/0IyAbgOEB9QAwzWS1
RFEQdpklN4Vxu+4qwkpEUWtl0cpJV8buVab33eUgDI1WuN/jo8nzF0GWpFwkHUJp
4VEYDP+9zWssKUGgtsV0LPadXFsk74f9KW0q1FN+UljnEBBksPtRfGok1TQSzesH
m0JlsdZcOBMFjNA+k7cQ3xyZi4b7tERRe8NZ1dewvHMBGpeh5J/n/TwHVO/4NO4Z
S7qAENfXCP8PWblW5LgvUSlxpyKbwma5ygHe7M1/RnmzMQO1BRkcq0x78ktyxWwU
Nq1hh4/ETvJgy3j3FIIm2AZeRRo+I1HhhJ1DuqKsqs3KNsM/+jToHrkel7Qi4WtT
nzyK66L2Tb/MKGsXq2lyU9UC2U4REW3FTi0btmEnRl35RCUyhWbNppl2eZDaheHk
NKnJV/wgZvgJUVra4Gt6pverD2dPL9/PA6V/M27tF1R9/buUMeEyQYVcBPBw5zSB
ySIzD/fI
=er/p
-----END PGP SIGNATURE-----

@@ -1457,7 +1457,7 @@ PackageMempoolAcceptResult ProcessNewPackage(CChainState& active_chainstate, CTx
assert(std::all_of(package.cbegin(), package.cend(), [](const auto& tx){return tx != nullptr;}));

std::vector<COutPoint> coins_to_uncache;
const CChainParams& chainparams = Params();
const CChainParams& chainparams = active_chainstate.m_params;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5c67e84 nit: .m_chainman.GetParams()

Seems odd to add a TODO and violate it in the same commit ( /* TODO: replace with m_chainman.GetParams() */)

@@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
const uint32_t dep_mask{g_versionbitscache.Mask(chainParams->GetConsensus(), dep)};
BOOST_CHECK(!(chain_all_vbits & dep_mask));
chain_all_vbits |= dep_mask;
check_computeblockversion(chainParams->GetConsensus(), dep);
check_computeblockversion(g_versionbitscache, chainParams->GetConsensus(), dep);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eca22c7 nit: Later diff could be smaller by a few lines if you added a VersionBitsCache& vbcache{g_versionbitscache}; in this commit already.

@maflcko maflcko merged commit 25dd4d8 into bitcoin:master May 13, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 13, 2022
}

BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
{
VersionBitsCache vbcache; // don't use chainman versionbitscache since we want custom chain params
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed chainman completely from this test in #25125

aureleoules added a commit to aureleoules/bitcoin that referenced this pull request Aug 12, 2022
aureleoules added a commit to aureleoules/bitcoin that referenced this pull request Sep 16, 2022
aureleoules added a commit to aureleoules/bitcoin that referenced this pull request Oct 10, 2022
maflcko pushed a commit that referenced this pull request Oct 19, 2022
5d3f98d refactor: Replace m_params with chainman.GetParams() (Aurèle Oulès)

Pull request description:

  Fixes a TODO introduced in #24595.
  Removes `m_params` from `CChainState` class and replaces it with `m_chainman.GetParams()`.

ACKs for top commit:
  MarcoFalke:
    review ACK 5d3f98d 🌎

Tree-SHA512: de0fe31450d281cc7307c0d820495e86c93c7998e77a148db2c703da66cff1059e6560c041f1864913c42075aa24d259c2623d45e929ca0a8056ed330a9f9978
adam2k pushed a commit to adam2k/bitcoin that referenced this pull request Oct 19, 2022
satsie pushed a commit to satsie/bitcoin that referenced this pull request Oct 31, 2022
@bitcoin bitcoin locked and limited conversation to collaborators May 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants