mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge #19069: refactor: replace pointers by references within tx_verify.{h,cpp}
b00266fe0crefactor: replace pointers by references within tx_verify.{h,cpp} (Sebastian Falbesoner) Pull request description: This PR gets rid of another unnecessary use of raw pointers, similar to PR #19053 (see also issue #19062 where useful commands for finding potential candidates are listed) but in the tx verification module. For the functions `CalculateSequenceLocks()` and `SequenceLocks()`, the `prevHeights` vector parameter type is changed to be passed as a reference. Note that there were no checks for null pointers -- if one would pass `nullptr` to one of the functions, the following line would immediately lead to a crash:dcacea096e/src/consensus/tx_verify.cpp (L32)ACKs for top commit: Empact: Code Review ACK https://github.com/bitcoin/bitcoin/pull/19069/commits/b00266fe0cf05fe6044f471105ce2bfed4349626 Tree-SHA512: 0eb71591467905434082029128bdca4df94988c372af40dca325654f6c002c72a00c73776cb5e72d6de2b2f218649211a5dbf19300a2e01f1841d6034e0f01e0
This commit is contained in:
commit
a79bca2f1f
4 changed files with 11 additions and 11 deletions
|
|
@ -302,7 +302,7 @@ bool CheckSequenceLocks(const CTxMemPool& pool, const CTransaction& tx, int flag
|
|||
prevheights[txinIndex] = coin.nHeight;
|
||||
}
|
||||
}
|
||||
lockPair = CalculateSequenceLocks(tx, flags, &prevheights, index);
|
||||
lockPair = CalculateSequenceLocks(tx, flags, prevheights, index);
|
||||
if (lp) {
|
||||
lp->height = lockPair.first;
|
||||
lp->time = lockPair.second;
|
||||
|
|
@ -2172,7 +2172,7 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
prevheights[j] = view.AccessCoin(tx.vin[j].prevout).nHeight;
|
||||
}
|
||||
|
||||
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, "bad-txns-nonfinal");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue