What prevents an arbitrarily high nSequence value when spending an OP_CSV output?
I have gone through the many related questions here on stack exchange and obviously read BIP68 and BIP112, but I still cannot seem to come to a clear answer for the following question: what is preventing a transaction that spends an output encumbered by OP_CSV
from setting an arbitrarily high nSequence
value?
Let's imagine the following scenario:
txA
has a single output encumbered by10 OP_CSV
, meaning this output can only be included in a transaction that is mined 10 blocks aftertxA
is confirmedtxB
spends a single input, which is the one output created fromtxA
The function that performs the check is
template <class T>
bool GenericTransactionSignatureChecker<T>::CheckSequence(const CScriptNum& nSequence) const
{
// Relative lock times are supported by comparing the passed
// in operand to the sequence number of the input.
const int64_t txToSequence = (int64_t)txTo->vin[nIn].nSequence;
...
omitted logic
...
// Now that we know we're comparing apples-to-apples, the
// comparison is a simple numeric one.
if (nSequenceMasked > txToSequenceMasked)
return false;
return true;
}
Why should the spending transaction not be able to set nSequence
for the input in such a way that txToSequenceMasked
is always higher than nSequenceMasked
? What exactly is preventing this? I feel like I'm missing something obvious here.
Hopefully my question makes sense, thanks!
from Recent Questions - Bitcoin Stack Exchange https://ift.tt/nEXkSFw
via IFTTT