Consensus: Adapt declarations of most obviously consensus functions #6591

pull jtimon wants to merge 6 commits into bitcoin:master from jtimon:consensus-params-0.12.99 changing 22 files +202 −103
  1. jtimon commented at 11:28 pm on August 26, 2015: contributor

    Before the first step #5696 (after creating an initial libconsensus and without counting checkpoints and Consensus::Params changes) gets negated (see #6526), here’s a little second step towards completing libconsensus. This is also part of #5970 process of explicitly passing chainparams around, and in that sense it replaces #6024.

    The function declarations are adapted and moved to consensus/consensus.h Since we’re touching all declarations, it is diff-wise free to put them in the Consensus namespace at the same time. It also cherry picks one commit from #6526 (modified to rename CheckTransaction to Consensus::CheckTx [again, that rename is diff-wise free]).

    The function definitions are left in main.cpp for now, but some of them will have to be moved to consensus/consensus.cpp before exposing anything else in libconsensus (my preference would be to expose VerifyHeader next, but I haven’t got much feedback in that reward).

    Blocked by:

    • Blocksize: Turn MAX_BLOCK_SIZE and MAX_BLOCK_SIGOPS into functions #6625
  2. dcousens commented at 11:33 pm on August 26, 2015: contributor
    concept ACK
  3. jonasschnelli commented at 7:01 am on August 27, 2015: contributor
    Concept ACK. Not sure if GetAdjustedTime() as param is required. After this PR there would be 5 more calls to GetAdjustedTime() (which is maybe not very time critical but at least it locks cs_nTimeOffset).
  4. jtimon commented at 9:30 pm on August 29, 2015: contributor
    @jonasschnelli GetAdjustedTime() is not welcomed in libconsensus. Maybe @theuni can give more details about why. A vague explanation would be that libconsensus has to be stateless. In main.cpp (full of global variables anyway) it’s just fine, but these functions will be eventually moved to consensus.cpp to be built independently for libconsensus (or at least that’s my plan).
  5. jtimon force-pushed on Sep 2, 2015
  6. jtimon force-pushed on Sep 4, 2015
  7. jtimon commented at 8:20 pm on September 4, 2015: contributor
    Rebased on top of modified #6625 and force-pushed.
  8. consensus: don't define MAX_STANDARD_TX_SIGOPS in terms of block size 18a33b3979
  9. consensus: teach ExtractMatches to check for an arbitrary max transaction number
    This is a no-op change. For now, everything passes MAX_BLOCK_SIZE / 60, so the
    result matches what it would've before.
    
    Tests use a number equal to the number of transactions where necessary,
    to ensure that they're never rejected when blocksizesize isn't being tested.
    5cb4d7e20e
  10. consensus: teach CheckTransaction to check for an arbitrary max tx size
    This is a no-op change. For now, everything passes MAX_BLOCK_SIZE, so the
    result matches what it would've before.
    
    Tests use a value of std::numeric_limits<uint64_t>::max() where necessary, to ensure that they're never
    rejected when size isn't being tested.
    660e072519
  11. consensus: Move consensus constants into Consensus::Params and consensus.h (as functions)
    The following are now tied to a chain rather than being defined as global
    constants. Their values have not changed.
    
    nMinTxSize
    nMaxBlockSize
    nMaxTxSize
    nMaxBlockSigops
    nCoinbaseMaturity
    
    Also, for free (diff-wise):
    
    Blocksize: Turn MAX_BLOCK_SIZE (nMaxBlockSize) and MAX_BLOCK_SIGOPS (nMaxBlockSigops) into functions
    
    ...which take Consensus::Params as parameter
    This will be convenient to reduce the diff of any proposal that changes the blocksize as a hardfork
    0cac6d221f
  12. Consensus: MOVEONLY: Most important consensus function declarations to consensus/consensus.h e07b3d71e2
  13. Consensus: Chainparams: Explicit Consensus::Params for consensus functions:
    -CheckBlockHeader
    -ContextualCheckBlockHeader
    -CheckBlock
    -ContextualCheckBlock
    
    Also add nTime parameter to CheckBlockHeader and CheckBlock.
    Also use the oportunity to rename the functions inside the Consensus namespace.
    be466dc9a5
  14. jtimon force-pushed on Sep 6, 2015
  15. laanwj added the label Consensus on Sep 8, 2015
  16. jtimon commented at 8:10 pm on September 14, 2015: contributor
    Closing in favor of #6672.
  17. jtimon closed this on Sep 14, 2015

  18. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me