WIP: Encapsulate consensus and policy code #5768

pull jtimon wants to merge 74 commits into bitcoin:master from jtimon:consensus_policy changing 89 files +2631 −2105
  1. jtimon commented at 2:11 am on February 8, 2015: contributor

    This is a work in progress. I’m trying to isolate consensus and policy code and this is my longest branch on that. I will open other PRs extracting subsets of this, but people interested in this work can see a unified thing here and hopefully I will e able to get some feedback. Please don’t comment on individual commits as this will be rebased very often (or do it, just be aware that your comments will probably disappear soon). So far this contains:

    *** WAIT_REVIEW MOVEONLY-ish: Preparations to not include main.h from any other header #5681 [main_includes] *** WAIT_REVIEW Cleanup: Don’t include main.h from any other header #5697 [main_includes2] *** WAIT_REVIEW MOVEONLY: Move constants and globals to consensus.h and policy.o #5696 [consensus_policy0] *** WAIT_REVIEW Consensus: Move CheckTransaction() from main to consensus/consensus #5669 [consensus](on main_includes) *** WAIT_REVIEW Refactor: Create CCoinsViewEfficient interface for CCoinsViewCache #5747 *** WAIT_REVIEW Policy: Create CPolicy interface and CStandardPolicy class implementing it #5595 [policy] *** WAIT_REVIEW Change: Refactor: inline main:GetMinRelayFee() in main:AcceptToMemoryPool() #5709 [getminrelayfee] *** WAIT_REVIEW TRIVIAL: Refactor: inline CTxIn::IsFinal() [ only used in main::IsFinalTx() ] #5769 [isfinal]

  2. jtimon force-pushed on Feb 8, 2015
  3. jtimon force-pushed on Feb 8, 2015
  4. jtimon force-pushed on Feb 8, 2015
  5. jtimon force-pushed on Feb 15, 2015
  6. jtimon force-pushed on Feb 15, 2015
  7. laanwj added the label Improvement on Feb 19, 2015
  8. jtimon force-pushed on Feb 21, 2015
  9. jtimon force-pushed on Feb 23, 2015
  10. jtimon force-pushed on Feb 24, 2015
  11. jtimon force-pushed on Mar 3, 2015
  12. jtimon force-pushed on Mar 5, 2015
  13. gavinandresen force-pushed the base branch on Mar 5, 2015
  14. jtimon force-pushed on Mar 10, 2015
  15. jtimon force-pushed on Mar 10, 2015
  16. jtimon force-pushed on Mar 10, 2015
  17. jtimon force-pushed on Mar 19, 2015
  18. jtimon force-pushed on Mar 25, 2015
  19. jtimon force-pushed on Mar 26, 2015
  20. Consensus: Create consensus/consensus.h with some constants f48d61ca85
  21. Consensus: Refactor: Decouple CValidationState from main::AbortNode() 49fd398fa9
  22. Consensus: MOVEONLY: Move CValidationState from main consensus/validation b746d48478
  23. Consensus: Refactor: turn main::GetBlockValue() into GetBlockSubsidy(Consensus::Params) 809373969f
  24. Consensus: Refactor: Decouple IsSuperMajority from Params() 52d1b8c291
  25. Consensus: SQUASHME: Cleanup: remove Consensus::Params getters from CChainParams bc7a24024d
  26. Consensus: Cleanup: remove Consensus::Params getters from CChainParams
    s/Params().HashGenesisBlock()/params.hashGenesisBlock
    9f175cc737
  27. Consensus: Refactor: Decouple from CChainParams: CheckBlockHeader,
    CheckBlock, ContextualCheckBlockHeader and ContextualCheckBlock
    15610220a4
  28. Consensus: Tests: Correct pow tests 46d3ce3eb1
  29. Consensus: Move Params().GetConsensus() up 42a3f650bf
  30. Consensus: Refactor: Consensus version of CheckBlockHeader() 39fd953ca5
  31. Consensus: Separate CheckIndexAgainstCheckpoint() from ContextualCheckBlockHeader 18a0234e08
  32. Consensus: Refactor: Consensus version of ContextualCheckBlockHeader() 73fd4854ff
  33. Policy: Create policy.o with some constants and globals a6b9dac987
  34. Consensus: MOVEONLY: Move CheckBlockHeader, IsSuperMajority and ContextualCheckBlockHeader() to consensus.o ce4d1a621a
  35. Consensus: MOVEONLY: move pow.o to consensus dir cac7f88462
  36. Consensus: Introduce Consensus::VerifyBlockHeader() 14f1c4c9a1
  37. Consensus: Refactor: CheckTransaction() -> Consensus::CheckTx()
    Decouple it from util.h [bool error(char*)] and BOOST_FOREACH
    5862fb1c7c
  38. Consensus: MOVEONLY-ish: Move GetLegacySigOpCount() from main to consensus ea9760918a
  39. Consensus: Refactor: Turn main::CheckBlock() into Consensus::CheckBlock() 5b4fd0cdf7
  40. Consensus: MOVEONLY: Move CheckTx and CheckBlock from main to consensus f79543aa18
  41. Includes: fix hidden dependencies 23d448b244
  42. Coins: Refactor: Separate CCoinsViewEfficient abstract class from CCoinsViewCache (make parent its class) f0ee3f0b0c
  43. Coins: MOVEONLY: Move CCoinsViewCache and CCoinsModifier to coinscache.o d2ca5ae820
  44. move Consensus::GetBlockSubsidy fb7bf06798
  45. Consensus: MOVEONLY: GetP2SHSigOpCount() from main to consensus 219904943e
  46. Consensus: Introduce Consensus::GetSigOpCount(CTransaction, CCoinsViewEfficient) f848147e9f
  47. Consensus: Refactor: Separate Consensus::CheckTxInputs from CheckInputs 4d14fa3970
  48. Consensus: Refactor: Move CTransaction::GetValueOut() to Consensus b11d3eea2e
  49. Consensus: MOVEONLY-ish: Move MAX_MONEY and MoneyRange() [renamed VerifyAmount] from amount.h to consensus.h a7fa2e37b6
  50. Consensus: Refactor: Introduce GetSpendHeight() 1431ccb379
  51. Consensus: Refactor: Safely remove !tx.IsCoinBase() check from main::CheckInputs() 0d8182daed
  52. Consensus: MOVEONLY: Consensus::CheckTxInputs() from main to consensus d5b606dd86
  53. Consensus: Refactor: Separate CheckInputs() into CheckInputsScripts and Consensus::CheckTxInputs() 3cef0c3093
  54. fix Consensus::GetValueOut 808fd8a9ee
  55. Consensus: Refactor: Decouple CheckInputsScripts() from global nScriptCheckThreads (remove pvChecks param) d97d8a57af
  56. Consensus: Introduce Consensus::CheckTxInputsScripts() and use it instead of CheckInputsScripts() when possible 0715b2387e
  57. Consensus: Refactor: Introduce Consensus::GetFlags
    and use it instead of MANDATORY_SCRIPT_VERIFY_FLAGS in miner::CreateNewBlock()
    0f8d996645
  58. Consensus: Refactor: Separate consensus version of IsFinalTx() 658bd6f61b
  59. Consensus: Refactor: Consensus version of Consensus::ContextualCheckBlock() d183008475
  60. Consensus: MOVEONLY: Move IsFinalTx and ContextualCheckBlock to consensus.o and hide IsSuperMajority() 7f61727b72
  61. Consensus: Introduce Consensus::VerifyTx() 48a2a4fc3c
  62. Consensus: Refactor: Introduce Consensus::EnforceBIP30 4c0e3014f3
  63. Consensus: Introduce Consensus::VerifyBlock() 19da7dd1cc
  64. Policy: Prepare utils for policy aa77acdc00
  65. Policy: Create CPolicy interface and CStandardPolicy implementation ee7c6e743c
  66. Policy: MOVEONLY: script/standard.o::IsStandard() -> CPolicy::ApproveScript() 551c742036
  67. Policy: Refactor: CTxOut::IsDust(CFeeRate) -> CPolicy::ApproveOutput(CTxOut)
    Decouples CTxOut from CFeeRate
    Simplifies IsDust() interface encapsulating the access to global minRelayTxFee
    Also move the new GetDustThreshold() from CTxOut to Policy
    ed7c1d5130
  68. Policy: Refactor: Create CPolicy::ApproveTx(tx, state) from main::IsStandardTx(tx, reason) 981a922e14
  69. Policy: MOVEONLY: main::AreInputsStandard() -> CPolicy::ApproveTxInputs() db55bc7333
  70. Includes: Cleanup includes ca8a76b79f
  71. LOCAL: notes on include main.h 563fadbb8f
  72. Policy: Replace STANDARD script flags with ALL (which adds SCRIPT_VERIFY_LOW_S) for signing
    The new ALL_SCRIPT_VERIFY_FLAGS in script/interpreter is independent from policy
    630a594f98
  73. Policy: MOVEONLY: Move CFeeRate to policy 59b7145c90
  74. Policy: MOVEONLY-ish: Move CMinerPolicyEstimator out of txmempool.o (CTxMemPoolEntry has to be separated temporarily as well) afe977f0c1
  75. Policy: Refactor: Don't pass a CTxMemPool param to CWallet::GetMinimumFee() 8714d8e08e
  76. Policy: Refactor: Decouple CTxMemPool from CMinerPolicyEstimator and policy::minRelayTxFee ba88aa1419
  77. Policy: Refactor: SQUASHED: inline GetMinRelayFee() in AcceptToMemoryPool() db84bc13a9
  78. Policy: Refactor: Simplify CheckInputsScripts 0c93f9b003
  79. Policy: SQUASHME: Refactor: Simplify CheckInputsScripts 1a94c8e5a4
  80. Policy: MOVEONLY: CPolicy::ApproveTxInputsScripts from main::CheckInputsScripts b50257bcaa
  81. Policy: Refactor: Move datacarrier policy logic to policy.o d994d6b1a6
  82. Policy: MOVEONLY: Turn fIsBareMultisigStd global into a CStandardPolicy attribute e0ff0d2bf2
  83. Policy: Introduce CPolicy attribute in CWallet 3b9614c593
  84. Policy: Encapsulate policy script verify flags as CStandardPolicy parameters 8c11a398b5
  85. Policy: MOVEONLY: initialize global minRelayTxFee in InitPolicyFromArgs()) a4f5995236
  86. Refactor: int nHeight = chainActive.Height() 48ade71903
  87. Policy: Separate CPolicy::ValidateTxFee() from main::AcceptToMemoryPool() 41ddb0568a
  88. Policy: Separate Standard and test policies to select them independently of the network 143d17ce79
  89. Policy: Replace CChainParams::fRequireStandard with CChainParams::strDefaultPolicy 3b88a863cf
  90. Policy: Introduce CPolicy::ValidateFee(CAmount, size_t) 3a7b66da4f
  91. Policy: Introduce CPolicy::ValidateFeeRate(CFeeRate) 04b651ba3a
  92. Policy: Pass policy as parameter in many main and miner functions b9fb65776b
  93. Policy: Introduce CPolicy::GetMinRelayFeeRate() 61145b4817
  94. jtimon force-pushed on Apr 2, 2015
  95. jtimon commented at 7:17 pm on April 13, 2015: contributor
    Closing for now
  96. jtimon closed this on Apr 13, 2015

  97. MarcoFalke locked this on Sep 8, 2021


jtimon

Labels
Refactoring


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-12-19 00:12 UTC

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