Page MenuHomePhabricator

D8478.diff
No OneTemporary

D8478.diff

diff --git a/src/consensus/tx_verify.h b/src/consensus/tx_verify.h
--- a/src/consensus/tx_verify.h
+++ b/src/consensus/tx_verify.h
@@ -50,7 +50,7 @@
*/
std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx,
int flags,
- std::vector<int> *prevHeights,
+ std::vector<int> &prevHeights,
const CBlockIndex &block);
bool EvaluateSequenceLocks(const CBlockIndex &block,
@@ -62,6 +62,6 @@
* tx's inputs (in order) confirmed.
*/
bool SequenceLocks(const CTransaction &tx, int flags,
- std::vector<int> *prevHeights, const CBlockIndex &block);
+ std::vector<int> &prevHeights, const CBlockIndex &block);
#endif // BITCOIN_CONSENSUS_TX_VERIFY_H
diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp
--- a/src/consensus/tx_verify.cpp
+++ b/src/consensus/tx_verify.cpp
@@ -68,9 +68,9 @@
*/
std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx,
int flags,
- std::vector<int> *prevHeights,
+ 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-
@@ -100,11 +100,11 @@
// 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))
@@ -149,7 +149,7 @@
}
bool SequenceLocks(const CTransaction &tx, int flags,
- std::vector<int> *prevHeights, const CBlockIndex &block) {
+ std::vector<int> &prevHeights, const CBlockIndex &block) {
return EvaluateSequenceLocks(
block, CalculateSequenceLocks(tx, flags, prevHeights, block));
}
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -524,7 +524,7 @@
BOOST_CHECK(!TestSequenceLocks(CTransaction(tx), flags));
// Sequence locks pass on 2nd block.
BOOST_CHECK(
- SequenceLocks(CTransaction(tx), flags, &prevheights,
+ SequenceLocks(CTransaction(tx), flags, prevheights,
CreateBlockIndex(::ChainActive().Tip()->nHeight + 2)));
// Relative time locked.
@@ -558,7 +558,7 @@
}
// Sequence locks pass 512 seconds later.
BOOST_CHECK(
- SequenceLocks(CTransaction(tx), flags, &prevheights,
+ SequenceLocks(CTransaction(tx), flags, prevheights,
CreateBlockIndex(::ChainActive().Tip()->nHeight + 1)));
for (int i = 0; i < CBlockIndex::nMedianTimeSpan; i++) {
// Undo tricked MTP.
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -231,7 +231,7 @@
prevheights[txinIndex] = coin.GetHeight();
}
}
- lockPair = CalculateSequenceLocks(tx, flags, &prevheights, index);
+ lockPair = CalculateSequenceLocks(tx, flags, prevheights, index);
if (lp) {
lp->height = lockPair.first;
lp->time = lockPair.second;
@@ -1766,7 +1766,7 @@
prevheights[j] = view.AccessCoin(tx.vin[j].prevout).GetHeight();
}
- if (!SequenceLocks(tx, nLockTimeFlags, &prevheights, *pindex)) {
+ if (!SequenceLocks(tx, nLockTimeFlags, prevheights, *pindex)) {
LogPrintf("ERROR: %s: contains a non-BIP68-final transaction\n",
__func__);
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS,

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:15 (16 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5183717
Default Alt Text
D8478.diff (4 KB)

Event Timeline