mirror of
https://github.com/bitcoin/bips.git
synced 2024-11-19 01:40:05 +01:00
More clearly define script execution failure pathway
This commit is contained in:
parent
4048f45316
commit
d30f1c6d0b
@ -20,16 +20,16 @@ being spent.
|
||||
==Summary==
|
||||
|
||||
CHECKSEQUENCEVERIFY redefines the existing NOP3 opcode.
|
||||
When executed, the script interpreter continues as if a NOP was executed
|
||||
so long as:
|
||||
When executed, if any of the following conditions are true, the script interpreter will terminate with an error:
|
||||
|
||||
* the top item on the stack is greater than or equal to 0; and
|
||||
* the top item on the stack does not have disable flag (1 << 31) set; and
|
||||
* the transaction version is 2 or above; and
|
||||
* the transaction input's sequence number does not have the disable flag (1 << 31) set; and
|
||||
* the top item on the stack and the transaction input's sequence number are both relative lock-times of the same type, and sequence number is greater than or equal to the top item on the stack.
|
||||
* the top item on the stack is less than 0; or
|
||||
* the top item on the stack has the disable flag (1 << 31) unset; and
|
||||
** the transaction version is less than 2; or
|
||||
** the transaction input sequence number disable flag (1 << 31) is set; and
|
||||
** the relative lock-time type is not the same; or
|
||||
** the top stack item is greater than the transaction sequence (when masked according to the BIP68);
|
||||
|
||||
Otherwise, script execution terminates with an error.
|
||||
Otherwise, script execution will continue as if a NOP had been executed.
|
||||
|
||||
BIP 68 prevents a non-final transaction from being selected for inclusion in a block until the corresponding input has reached the specified age, as measured in block-height or block-time. By comparing the argument to CHECKSEQUENCEVERIFY against the nSequence field, we indirectly verify a desired minimum age of the
|
||||
the output being spent; until that relative age has been reached any script execution pathway including the CHECKSEQUENCEVERIFY will fail to validate, causing the transaction not to be selected for inclusion in a block.
|
||||
@ -196,9 +196,9 @@ and correspondingly in Bob's commitment transaction:
|
||||
ELSE
|
||||
<R hash> EQUAL
|
||||
IF
|
||||
"24h" CHECKSEQUENCEVERIFY DROP
|
||||
DUP HASH160 <Alice key hash> CHECKSIGVERIFY
|
||||
ELSE
|
||||
"24h" CHECKSEQUENCEVERIFY DROP
|
||||
"2015/10/20 10:33" CHECKLOCKTIMEVERIFY DROP
|
||||
DUP HASH160 <Bob key hash> CHECKSIGVERIFY
|
||||
ENDIF
|
||||
@ -298,13 +298,13 @@ semantics and detailed rationale for those semantics.
|
||||
return false;
|
||||
|
||||
// Sequence numbers with their most significant bit set are not
|
||||
// consensus constrained. Testing that the transaction's sequence
|
||||
// defined by BIP68. Testing that the transaction's sequence
|
||||
// number do not have this bit set prevents using this property
|
||||
// to get around a CHECKSEQUENCEVERIFY check.
|
||||
if (txToSequence & CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG)
|
||||
return false;
|
||||
|
||||
// Mask off any bits that do not have consensus-enforced meaning
|
||||
// Mask off any bits that do not have BIP68 consensus-enforced meaning
|
||||
// before doing the integer comparisons of ::VerifySequence.
|
||||
const uint32_t nLockTimeMask = CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG
|
||||
| CTxIn::SEQUENCE_LOCKTIME_MASK;
|
||||
@ -365,7 +365,7 @@ related proposals for improving Bitcoin's lock-time capabilities, including:
|
||||
OP_CHECKLOCKTIMEVERIFY,
|
||||
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP 68]:
|
||||
Consensus-enforced transaction replacement signalled via sequence numbers,
|
||||
Relative lock-time through consensus-enforced sequence numbers,
|
||||
|
||||
and [https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki BIP 113]:
|
||||
Median-Past-Time-Lock.
|
||||
@ -386,7 +386,7 @@ Thanks to Eric Lombrozo and Anthony Towns for contributing example use cases.
|
||||
|
||||
==References==
|
||||
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP 68] Consensus-enforced transaction replacement signalled via sequence numbers
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP 68] Relative lock-time through consensus-enforced sequence numbers
|
||||
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP 65] OP_CHECKLOCKTIMEVERIFY
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user