HomePhabricator

refactor: Move calculation logic out from `CheckSequenceLocksAtTip()`

Description

refactor: Move calculation logic out from CheckSequenceLocksAtTip()

Summary:
It is not obvious that CheckSequenceLocksAtTip() function can modify its LockPoints* lp parameter which leads to bugs such as https://github.com/bitcoin/bitcoin/pull/22677#discussion_r762040101 (bug avoided in D12441 by squashing the fix with the commit introducing it)

This is a backport of core#23897

Notes:

  • that this codebase has a single call site for CheckSequenceLocksAtTip in PreChecks. This is called via AcceptToMemoryPool in DisconnectedBlockTransactions::updateMempoolForReorg, so we don't have to deal with the code duplication in Core's Chainstate::MaybeUpdateMempoolForReorg function
  • this codebase no longer has the LockPoint::maxInputBlock computation code (see D15788)

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16104

Details

Event Timeline