diff options
author | glozow <gloriajzhao@gmail.com> | 2023-02-28 16:47:15 +0000 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2023-02-28 16:53:02 +0000 |
commit | a8080c0def0be59b98fe418d1e8efaf502a20062 (patch) | |
tree | 94f1828d3c5e7ca3f55db9a09910b04d58c454ba /src/test | |
parent | 8303f11e106807ea82938b2f3878b33daedb3d3f (diff) | |
parent | 75db62ba4cae048e742ca02dc6a52b3b3d6727de (diff) |
Merge bitcoin/bitcoin#23897: refactor: Move calculation logic out from `CheckSequenceLocksAtTip()`
75db62ba4cae048e742ca02dc6a52b3b3d6727de refactor: Move calculation logic out from `CheckSequenceLocksAtTip()` (Hennadii Stepanov)
3bc434f4590758db673e1bd4ebf1906ea632f593 refactor: Add `CalculateLockPointsAtTip()` function (Hennadii Stepanov)
Pull request description:
This PR is follow up for bitcoin/bitcoin#22677 and bitcoin/bitcoin#23683.
On master (013daed9acca1b723f599d63ab36b9c2a5c60e5f) it is not obvious that `CheckSequenceLocksAtTip()` function can modify its `LockPoints* lp` parameter which leads to https://github.com/bitcoin/bitcoin/pull/22677#discussion_r762040101.
This PR:
- separates the lockpoint calculate logic from `CheckSequenceLocksAtTip()` function into a new `CalculateLockPointsAtTip()` one
- cleans up the `CheckSequenceLocksAtTip()` function interface
- makes code easier to reason about (hopefully)
ACKs for top commit:
achow101:
ACK 75db62ba4cae048e742ca02dc6a52b3b3d6727de
stickies-v:
re-ACK 75db62b
Tree-SHA512: 072c3fd9cd1e1b0e0bfc8960a67b01c80a9f16d6778f374b6944ade03a020415ce8b8ab2593b0f5e787059c8cf90af798290b4c826785d41955092f6e12e7486
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/miner_tests.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 9e484f919e..cfab762307 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -37,7 +37,9 @@ struct MinerTestingSetup : public TestingSetup { bool TestSequenceLocks(const CTransaction& tx, CTxMemPool& tx_mempool) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { CCoinsViewMemPool view_mempool{&m_node.chainman->ActiveChainstate().CoinsTip(), tx_mempool}; - return CheckSequenceLocksAtTip(m_node.chainman->ActiveChain().Tip(), view_mempool, tx); + CBlockIndex* tip{m_node.chainman->ActiveChain().Tip()}; + const std::optional<LockPoints> lock_points{CalculateLockPointsAtTip(tip, view_mempool, tx)}; + return lock_points.has_value() && CheckSequenceLocksAtTip(tip, *lock_points); } CTxMemPool& MakeMempool() { |