bip9/bip113/libconsensus-p2a: Deployment preparations forBIP113 + #7552 + Introduce Consensus::VerifyTx() #7565

pull jtimon wants to merge 2 commits into bitcoin:master from jtimon:libconsensus-p2a-verifytx-bip113-0.12.99 changing 5 files +85 −25
  1. jtimon commented at 2:13 am on February 20, 2016: contributor

    This unifies the recent locktime validation flags with the script ones for easier consensus deployment via BIP9 as implemented in #7566. It facilitates deploying BIP113 in this way by moving the check to ConnectBlock() and use the unified consensus validation flags.

    Like #7566, it finally introduces “the src/consensus/consensus.cpp file” which is a place intended to attract new consensus code (as opposed to keep putting it in main.cpp like bip113 and bip68).

    This PR introduces Consensus::CheckTxPreInputs(), which does all the consensus checks common for coinbase and noncoinbase transactions (which implies none of the checks use the inputs of the transction nor the utxo state). Note that this introduces a redundant call to main::CheckTransaction() in main::ConnectBlock() which also calls main::CheckBlock() [which calls main::CheckTransaction()]. We can eat either:

    a) Eat the redundant main::CheckTransaction() call per tx per block. b) Remove it from main::CheckBlock() c) Don’t call main::CheckTransaction() from Consensus::CheckTxPreInputs() in this PR

    I don’t want to decide myself.

    In addition to Consensus::CheckTxPreInputs(), the PR introduces Consensus::VerifyTx(), which in its current incomplete implementation seems pretty stupid, as it only calls Consensus::CheckTxPreInputs().
    But there’s many more things that could be encapsulated besides that, for example, in https://github.com/jtimon/bitcoin/commits/jt see:

    https://github.com/jtimon/bitcoin/commit/a61cec80c7838045a2241f56d76f2f8f840c39aa https://github.com/jtimon/bitcoin/commit/a408a5d7fce48c7838017fc67f0815e7ea218656 https://github.com/jtimon/bitcoin/commit/5817f754e71701fc198bed04fa7e809549fd1ace https://github.com/jtimon/bitcoin/commit/6aed9aaaf0c4d48fae673221085a6c514ae81583 https://github.com/jtimon/bitcoin/commit/032182336d84a420f33be3ab7d204c9b5f8ae8cf https://github.com/jtimon/bitcoin/commit/8c28d1a4175e51199020ca8bbc3e1ecedc862e46 https://github.com/jtimon/bitcoin/commit/473696c4624cc4a7676a42cb0e98293d29e2c864

    I believe #7552 should wait for a subset of those commits or equivalent to avoid duplicating code or exposing an incomplete API that is harder to change later.

    Context: The main goal of this PR is advancing in libconsensus phase 2 decribed in the to-be-released-because-its-fortunately-already-outdated promised document with pictures. In the absence of a publishable document with pictures for a plan to encapsulate, expose and separate libbitcoinconsensus from bitcoin core, here’s a summary including open PRs and other maintained branches:

    ** TODO libconsensus-p2: Put all the consensus critical code excluding storage in the consensus building package #NO_PR [no_branch] *** REBASE [1/4] libconsensus-p2a: Build consensus/consensus.o with the consensus package #NO_PR [libconsensus-p2a] Last version: 72cdd1f **** PR bip9/bip113/libconsensus-p2a: Deployment preparations forBIP113 + #7552 + Introduce Consensus::VerifyTx() #7565 [libconsensus-p2a-verifytx-bip113-0.12.99] **** REBASE libconsensus-p2a: Decouple pow.o from chain.o and move it to the consensus package #7563 [libconsensus-p2a-chain-cpp-interface-0.12.99] **** REBASE libconsensus-p2a: Preparations to decouple libconsensus from coins.o #7564 [libconsensus-p2a-coins-cpp-interface-0.12.99] ** libconsensus-p3: Complete C API for consensus non-storage functionality (within the same package) #NO_PR [libconsensus-p3] ** libconsensus-p4: Separate libconsensus into its own repository like libsecp256k1 #NO_PR [no_branch] ** libconsensus-p5: Stop reusing libconsensus’ internal code in Bitcoin Core ** libconsensus-p6: Import libconsensus from Bitcoin Core as an external dependency

    legend: [branch-name] = github/jtimon/bitcoin/branch-name p2 = phase 2 p2a = phase 2-A

    (Extracted from https://github.com/jtimon/doc/blob/master/branches/bitcoin.org if you use org-mode in emacs or vim)

  2. jtimon force-pushed on Feb 20, 2016
  3. jtimon force-pushed on Feb 20, 2016
  4. jtimon force-pushed on Feb 20, 2016
  5. jonasschnelli added the label Refactoring on Feb 20, 2016
  6. jtimon force-pushed on Feb 22, 2016
  7. jtimon force-pushed on Feb 23, 2016
  8. BIP113: Introduce Consensus::VerifyTx() and Consensus::CheckTxPreInputs()
    Also move the locktime flags with the script ones.
    a355de8018
  9. jtimon force-pushed on Feb 25, 2016
  10. fixup travis? bf6ebd4c8c
  11. jtimon commented at 10:54 am on March 3, 2016: contributor
    I don’t know why travis is unhappy yet, but it doesn’t seem like there’s a lot of interest anyway. I will reopen when there’s more interest or after the promised doc with pictures.
  12. jtimon closed this on Mar 3, 2016

  13. DrahtBot 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-11-17 21:12 UTC

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