BIP-112: Mempool-only CHECKSEQUENCEVERIFY #7524

pull btcdrak wants to merge 3 commits into bitcoin:master from btcdrak:checksequenceverify changing 8 files +248 −3
  1. btcdrak commented at 5:29 pm on February 12, 2016: contributor

    Replace NOP3 with CHECKSEQUENCEVERIFY (BIP-112)

    The BIP text is at https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki

    This PR follows on from #6564 and is rebased (with #7184 which has been merged top master) so can now be tested directly.

    Functional test scripts by @ajtowns can be found at https://github.com/ajtowns/op_csv-test

    For reviewers please note that #6564 remained unchanged for several months. The list of reviews in #6564 were as follows:

  2. morcos commented at 8:45 pm on February 12, 2016: member
    My comment remains that I would prefer VerifyLockTime not be encapsulated for reuse for nLockTime and nSequence checks.
  3. btcdrak commented at 6:39 am on February 13, 2016: contributor
    @morcos @petertodd I agree the encapsulation hampers readability. I propose something like 2fcd56f.
  4. NicolasDorier commented at 7:22 am on February 13, 2016: contributor
    ACK 2fcd56f
  5. BIP112: Implement CHECKSEQUENCEVERIFY
    - Replace NOP3 with CHECKSEQUENCEVERIFY (BIP112)
      <nSequence> CHECKSEQUENCEVERIFY -> <nSequence>
    - Fails if txin.nSequence < nSequence, allowing funds of a txout to be locked for a number of blocks or a duration of time after its inclusion in a block.
    - Pull most of CheckLockTime() out into VerifyLockTime(), a local function that will be reused for CheckSequence()
    - Add bitwise AND operator to CScriptNum
    - Enable CHECKSEQUENCEVERIFY as a standard script verify flag
    - Transactions that fail CSV verification will be rejected from the mempool, making it easy to test the feature. However blocks containing "invalid" CSV-using transactions will still be accepted; this is *not* the soft-fork required to actually enable CSV for production use.
    53e53a33c9
  6. Separate CheckLockTime() and CheckSequence() logic
    For the sake of a little repetition, make code more readable.
    c3c375226e
  7. btcdrak force-pushed on Feb 14, 2016
  8. btcdrak commented at 7:43 pm on February 14, 2016: contributor

    I’ve squashed to two commits. 53e53a3 corresponds to the state of #6564 as per OP and c3c3752 (was 2fcd56f) addresses request from @morcos and @petertodd.

    Previous branch state for verification checksequenceverify_2fcd56f.

  9. laanwj added the label Mempool on Feb 15, 2016
  10. laanwj added the label TX fees and policy on Feb 15, 2016
  11. in src/script/interpreter.cpp: in c3c375226e outdated
    1226+    // the nSequenceMasked in the transaction.
    1227+    if (!(
    1228+        (txToSequenceMasked <  CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG && nSequenceMasked <  CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG) ||
    1229+        (txToSequenceMasked >= CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG && nSequenceMasked >= CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG)
    1230+    ))
    1231+        return false;
    


    laanwj commented at 9:09 am on February 16, 2016:
    This return false here seems to come out of the blue, which could make people misread the code and introduce bugs. I’d suggest adding the )) to the line before it, or surrounding with {}.
  12. laanwj commented at 9:24 am on February 16, 2016: member
    utACK 2fcd56f
  13. Code style fix.
    This if statement is a little obtuse and using braces here
    improves readability.
    a38107643f
  14. laanwj merged this on Feb 16, 2016
  15. laanwj closed this on Feb 16, 2016

  16. laanwj referenced this in commit 93c85d458a on Feb 16, 2016
  17. btcdrak deleted the branch on Dec 3, 2016
  18. wqking referenced this in commit 77e685e4e7 on Apr 26, 2018
  19. wqking referenced this in commit b63acd8e7f on Apr 26, 2018
  20. meyer9 referenced this in commit e7321f8dff on Jun 16, 2018
  21. meyer9 referenced this in commit 90454d2bc4 on Jun 16, 2018
  22. meyer9 referenced this in commit e1c1ffdf0d on Jun 16, 2018
  23. meyer9 referenced this in commit a444a5b0a8 on Jun 16, 2018
  24. meyer9 referenced this in commit de7acaba10 on Jul 4, 2018
  25. meyer9 referenced this in commit 4b42293ee9 on Jul 4, 2018
  26. wqking referenced this in commit 1fde81f71d on Apr 4, 2021
  27. wqking referenced this in commit e506572175 on Apr 4, 2021
  28. MarcoFalke 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-23 21:12 UTC

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