Skip to content

Commit

Permalink
Update compatibility section
Browse files Browse the repository at this point in the history
  • Loading branch information
btcdrak committed Nov 20, 2015
1 parent 7d7083f commit c141645
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bip-0068.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ https://github.com/bitcoin/bitcoin/pull/6312

Credit goes to Gregory Maxwell for providing a succinct and clear description of the behavior of this change, which became the basis of this BIP text.

This BIP was edited by BtcDrak and Nicolas Dorier.
This BIP was edited by BtcDrak, Nicolas Dorier and kinoshitajona.

==Deployment==

Expand All @@ -193,20 +193,20 @@ It is recommended to deploy BIP68 and BIP112 at the same time as this BIP.

==Compatibility==

The only use of sequence valuenumbers by the Bitcoin Core reference client software is to disable checking the nLockTime constraints in a transaction. The semantics of that application are preserved by this BIP.
The only use of sequence numbers by the Bitcoin Core reference client software is to disable checking the nLockTime constraints in a transaction. The semantics of that application are preserved by this BIP.

There may be other uses for the sequence valuenumber field that are not commonplace or yet to be discovered. To allow for other uses of the sequence valuenumber field, it is only interpreted as a relative lock-time as described in this BIP if the most significant bit is clear. This allows up to 31 bits of the sequence valuenumber field to be used for other purposes in applications which don't simultaneously need a per-input relative lock-time. In addition, the unused low-order bits of the relative lock-time encoding are available for use by future soft-fork extensions.
As can be seen from the specification section, a number of bits are undefined by this BIP to allow for other use cases by setting bit (1 << 31) as the remaining 31 bits have no meaning under this BIP. Additionally, bits (1 << 23) through (1 << 30) inclusive have no meaning at all when bit (1 << 31) is unset.

The most efficient way to calculate sequence valuenumber from relative lock-time is with bit masks and shifts:
The most efficient way to calculate sequence number from relative lock-time is with bit masks and shifts:

<pre>
// 0 <= nHeight < 65,535 blocks (1.25 years)
nSequence = nHeight << 14;
nHeight = nSequence >> 14;
nSequence = nHeight;
nHeight = nSequence;

// 0 <= nTime < 33,554,431 seconds (1.06 years)
nSequence = 1<<30 | (nTime << 5);
nTime = (nSequence ^ 1<<30) >> 5;
nSequence = (1 << 22) | (nTime >> 9);
nTime = (nSequence & 0x0000ffff) << 9;
</pre>

==References==
Expand Down

0 comments on commit c141645

Please sign in to comment.