mirror of
https://github.com/bitcoin/bips.git
synced 2025-05-12 12:03:29 +00:00
BIP65 assigned for CHECKLOCKTIMEVERIFY
This commit is contained in:
parent
5f6cb04d9c
commit
b05bc1ef53
@ -236,6 +236,12 @@ Those proposing changes should consider that ultimately consent may rest with th
|
|||||||
| Standard
|
| Standard
|
||||||
| Draft
|
| Draft
|
||||||
|-
|
|-
|
||||||
|
| [[bip-0065.mediawiki|65]]
|
||||||
|
| OP_CHECKLOCKTIMEVERIFY
|
||||||
|
| Peter Todd
|
||||||
|
| Standard
|
||||||
|
| Draft
|
||||||
|
|-
|
||||||
| [[bip-0070.mediawiki|70]]
|
| [[bip-0070.mediawiki|70]]
|
||||||
| Payment protocol
|
| Payment protocol
|
||||||
| Gavin Andresen
|
| Gavin Andresen
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<pre>
|
<pre>
|
||||||
BIP:
|
BIP: 65
|
||||||
Title: OP_CHECKLOCKTIMEVERIFY
|
Title: OP_CHECKLOCKTIMEVERIFY
|
||||||
Author: Peter Todd <pete@petertodd.org>
|
Author: Peter Todd <pete@petertodd.org>
|
||||||
Status: Draft
|
Status: Draft
|
||||||
@ -85,13 +85,13 @@ funds with the following scriptSig:
|
|||||||
===Non-interactive time-locked refunds===
|
===Non-interactive time-locked refunds===
|
||||||
|
|
||||||
There exist a number of protocols where a transaction output is created that
|
There exist a number of protocols where a transaction output is created that
|
||||||
the co-operation of both parties to spend the output. To ensure the failure of
|
requires the co-operation of both parties to spend the output. To ensure the
|
||||||
one party does not result in the funds becoming lost refund transactions are
|
failure of one party does not result in the funds becoming lost refund
|
||||||
setup in advance using nLockTime. These refund transactions need to be created
|
transactions are setup in advance using nLockTime. These refund transactions
|
||||||
interactively, and additionaly, are currently vulnerable to transaction
|
need to be created interactively, and additionaly, are currently vulnerable to
|
||||||
mutability. CHECKLOCKTIMEVERIFY can be used in these protocols, replacing the
|
transaction mutability. CHECKLOCKTIMEVERIFY can be used in these protocols,
|
||||||
interactive setup with a non-interactive setup, and additionally, making
|
replacing the interactive setup with a non-interactive setup, and additionally,
|
||||||
transaction mutability a non-issue.
|
making transaction mutability a non-issue.
|
||||||
|
|
||||||
|
|
||||||
====Two-factor wallets====
|
====Two-factor wallets====
|
||||||
@ -193,13 +193,13 @@ semantics and detailed rationale for those semantics.
|
|||||||
// CHECKLOCKTIMEVERIFY
|
// CHECKLOCKTIMEVERIFY
|
||||||
//
|
//
|
||||||
// (nLockTime -- nLockTime )
|
// (nLockTime -- nLockTime )
|
||||||
|
|
||||||
if (!(flags & SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY))
|
if (!(flags & SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY))
|
||||||
break; // not enabled; treat as a NOP
|
break; // not enabled; treat as a NOP
|
||||||
|
|
||||||
if (stack.size() < 1)
|
if (stack.size() < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Note that elsewhere numeric opcodes are limited to
|
// Note that elsewhere numeric opcodes are limited to
|
||||||
// operands in the range -2**31+1 to 2**31-1, however it is
|
// operands in the range -2**31+1 to 2**31-1, however it is
|
||||||
// legal for opcodes to produce results exceeding that
|
// legal for opcodes to produce results exceeding that
|
||||||
@ -215,13 +215,13 @@ semantics and detailed rationale for those semantics.
|
|||||||
// to 5-byte bignums, which are good until 2**32-1, the
|
// to 5-byte bignums, which are good until 2**32-1, the
|
||||||
// same limit as the nLockTime field itself.
|
// same limit as the nLockTime field itself.
|
||||||
const CScriptNum nLockTime(stacktop(-1), 5);
|
const CScriptNum nLockTime(stacktop(-1), 5);
|
||||||
|
|
||||||
// In the rare event that the argument may be < 0 due to
|
// In the rare event that the argument may be < 0 due to
|
||||||
// some arithmetic being done first, you can always use
|
// some arithmetic being done first, you can always use
|
||||||
// 0 MAX CHECKLOCKTIMEVERIFY.
|
// 0 MAX CHECKLOCKTIMEVERIFY.
|
||||||
if (nLockTime < 0)
|
if (nLockTime < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// There are two times of nLockTime: lock-by-blockheight
|
// There are two times of nLockTime: lock-by-blockheight
|
||||||
// and lock-by-blocktime, distinguished by whether
|
// and lock-by-blocktime, distinguished by whether
|
||||||
// nLockTime < LOCKTIME_THRESHOLD.
|
// nLockTime < LOCKTIME_THRESHOLD.
|
||||||
@ -234,12 +234,12 @@ semantics and detailed rationale for those semantics.
|
|||||||
(txTo.nLockTime >= LOCKTIME_THRESHOLD && nLockTime >= LOCKTIME_THRESHOLD)
|
(txTo.nLockTime >= LOCKTIME_THRESHOLD && nLockTime >= LOCKTIME_THRESHOLD)
|
||||||
))
|
))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Now that we know we're comparing apples-to-apples, the
|
// Now that we know we're comparing apples-to-apples, the
|
||||||
// comparison is a simple numeric one.
|
// comparison is a simple numeric one.
|
||||||
if (nLockTime > (int64_t)txTo.nLockTime)
|
if (nLockTime > (int64_t)txTo.nLockTime)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Finally the nLockTime feature can be disabled and thus
|
// Finally the nLockTime feature can be disabled and thus
|
||||||
// CHECKLOCKTIMEVERIFY bypassed if every txin has been
|
// CHECKLOCKTIMEVERIFY bypassed if every txin has been
|
||||||
// finalized by setting nSequence to maxint. The
|
// finalized by setting nSequence to maxint. The
|
||||||
@ -252,9 +252,9 @@ semantics and detailed rationale for those semantics.
|
|||||||
// required to prove correct CHECKLOCKTIMEVERIFY execution.
|
// required to prove correct CHECKLOCKTIMEVERIFY execution.
|
||||||
if (txTo.vin[nIn].IsFinal())
|
if (txTo.vin[nIn].IsFinal())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
https://github.com/petertodd/bitcoin/commit/ab0f54f38e08ee1e50ff72f801680ee84d0f1bf4
|
https://github.com/petertodd/bitcoin/commit/ab0f54f38e08ee1e50ff72f801680ee84d0f1bf4
|
Loading…
x
Reference in New Issue
Block a user