|
|
|
@ -27,9 +27,9 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeights, const CBlockIndex& block)
|
|
|
|
|
std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector<int>& prevHeights, const CBlockIndex& block)
|
|
|
|
|
{
|
|
|
|
|
assert(prevHeights->size() == tx.vin.size());
|
|
|
|
|
assert(prevHeights.size() == tx.vin.size());
|
|
|
|
|
|
|
|
|
|
// Will be set to the equivalent height- and time-based nLockTime
|
|
|
|
|
// values that would be necessary to satisfy all relative lock-
|
|
|
|
@ -59,11 +59,11 @@ std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags
|
|
|
|
|
// consensus-enforced meaning at this point.
|
|
|
|
|
if (txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG) {
|
|
|
|
|
// The height of this input is not relevant for sequence locks
|
|
|
|
|
(*prevHeights)[txinIndex] = 0;
|
|
|
|
|
prevHeights[txinIndex] = 0;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int nCoinHeight = (*prevHeights)[txinIndex];
|
|
|
|
|
int nCoinHeight = prevHeights[txinIndex];
|
|
|
|
|
|
|
|
|
|
if (txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG) {
|
|
|
|
|
int64_t nCoinTime = block.GetAncestor(std::max(nCoinHeight-1, 0))->GetMedianTimePast();
|
|
|
|
@ -99,7 +99,7 @@ bool EvaluateSequenceLocks(const CBlockIndex& block, std::pair<int, int64_t> loc
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeights, const CBlockIndex& block)
|
|
|
|
|
bool SequenceLocks(const CTransaction &tx, int flags, std::vector<int>& prevHeights, const CBlockIndex& block)
|
|
|
|
|
{
|
|
|
|
|
return EvaluateSequenceLocks(block, CalculateSequenceLocks(tx, flags, prevHeights, block));
|
|
|
|
|
}
|
|
|
|
|