DEPENDENT: Policy: Turn policy globals into CStandardPolicy attributes #6423

pull jtimon wants to merge 3 commits into bitcoin:master from jtimon:policy-args-0.11.99 changing 10 files +220 −78
  1. jtimon commented at 6:32 pm on July 11, 2015: contributor

    Includes #6068 but has been separated from it to hopefully accelerate things. This separates the CPolicy interface from a CStandardPolicy reference implementation that initializes its attributes on init from command line options (it is friendly to GUI configuration as specified by @luke-jr ). This doesn’t introduce any new file (no globals/policy.o), any factory or container, any command line option or anything. Functionally, it just moves the a couple of relay help message options to a new policy group (where all relay options should end up).

    But…if it’s functionally equivalent…why eliminate globals from main.cpp ?

    Because…http://lmgtfy.com/?q=why+globals+are+wrong …sorry, because…http://c2.com/cgi/wiki?GlobalVariablesAreBad http://programmers.stackexchange.com/questions/148108/why-is-global-state-so-evil of many reasons.

    I understand that elimination several variables to put them together so that explicitly take them as parameters by all functions that need it is not a priority since it doesn’t functionally modify bitcoin core.

    On the other hand, introducing new policy options as attributes to a class that it’s sometimes used as a global (like CChainParams, what we started with it should be what we have in mind for CPolicy) is preferable to introducing a brand new global variable in main. But that won’t be possible until we introduce something like Policy::AppendHelpMessages() and CPolicy::InitFromArgs(), and more globals that are low priority to clean up keep accumulating in main.o.

    So, in summary, why do this? To give the opportunity to new PRs not to unnecessarily give us more global cleanup work when they’re created.

    Also (although I’m not going to continue that GUI part), making policy options GUI-configurable (and hopefully, in the future all new existing and new options “for free”) would be very nice too. The way I’ve understood this from @luke-jr, with Policy::AppendHelpMessages() and CPolicy::InitFromArgs() it is relatively easy to create a generic GUI that doesn’t require any more work outside those methods to introduce new policy attributes.

  2. jtimon renamed this:
    Policy: Turn policy globals into CStandardPolicy attributes
    DEPENDENT: Policy: Turn policy globals into CStandardPolicy attributes
    on Jul 11, 2015
  3. jtimon closed this on Jul 11, 2015

  4. jtimon force-pushed on Jul 11, 2015
  5. jtimon reopened this on Jul 11, 2015

  6. jtimon closed this on Jul 11, 2015

  7. Policy: RENAME: Introduce CPolicy interface and hidden CStandardPolicy class implementing it
    Rename 3 functions into CPolicy methods:
    
    - IsStandard -> policy.ApproveScript
    - IsStandardTx -> policy.ApproveTx
    - AreInputsStandard -> policy.ApproveTxInputs
    d227be961a
  8. Policy: Turn policy globals into CStandardPolicy attributes
    ...by separating CStandardPolicy implementation from CPolicy interface
    
    Eliminated globals:
    
    -fIsBareMultisigStd
    -fRequireStandard
    3d03f15126
  9. fixup! the whole point of exposing policy options is to allow users to select them a4b28c4912
  10. jtimon reopened this on Jul 22, 2015

  11. jtimon force-pushed on Jul 22, 2015
  12. jtimon closed this on Jul 23, 2015

  13. MarcoFalke locked this on Sep 8, 2021


jtimon


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

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