-
Notifications
You must be signed in to change notification settings - Fork 36.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BIP-112: Mempool-only CHECKSEQUENCEVERIFY #7524
Conversation
My comment remains that I would prefer VerifyLockTime not be encapsulated for reuse for nLockTime and nSequence checks. |
@morcos @petertodd I agree the encapsulation hampers readability. I propose something like 2fcd56f. |
ACK 2fcd56f |
utACK btcdrak@2fcd56f |
- 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.
For the sake of a little repetition, make code more readable.
2fcd56f
to
c3c3752
Compare
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 |
(txToSequenceMasked < CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG && nSequenceMasked < CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG) || | ||
(txToSequenceMasked >= CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG && nSequenceMasked >= CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG) | ||
)) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 {}
.
utACK 2fcd56f |
This if statement is a little obtuse and using braces here improves readability.
… txOut is empty, the function CheckTransaction in Phore rejects empty txOut while Bitcoin doesn't.
… txOut is empty, the function CheckTransaction in Phore rejects empty txOut while Bitcoin doesn't.
… txOut is empty, the function CheckTransaction in Phore rejects empty txOut while Bitcoin doesn't.
… txOut is empty, the function CheckTransaction in Phore rejects empty txOut while Bitcoin doesn't.
# Conflicts: # src/script/interpreter.cpp # src/script/interpreter.h # src/script/script.h
…ause the txOut is empty, the function CheckTransaction in Phore rejects empty txOut while Bitcoin doesn't.
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: