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

Provenance
Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>Authored on Jan 31 2023, 13:26
PiRKCommitted on May 6 2024, 11:53
PiRKPushed on May 6 2024, 11:53
Reviewer
Restricted Project
Differential Revision
D16104: refactor: Move calculation logic out from `CheckSequenceLocksAtTip()`
Parents
rABC7b4e342de013: prune: scan and unlink already pruned block files on startup
Branches
Unknown
Tags
Unknown