Page MenuHomePhabricator

Merge the disconnection and erasing loops in RewindBlockIndex
AbandonedPublic

Authored by fpelliccioni on Dec 10 2019, 15:08.

Details

Reviewers
Fabien
deadalnix
Group Reviewers
Restricted Project
Summary

This PR makes a number of improvements to the InvalidateBlock (invalidateblock RPC) and RewindBlockIndex functions, primarily around breaking up their long-term cs_main holding. In addition:

  • They're made safely interruptible (bitcoind can be shutdown, and no progress in either will be lost, though if incomplete, invalidateblock won't continue after restart and will need to be called again)
  • The validation queue is prevented from overflowing (meaning invalidateblock on a very old block will not drive bitcoind OOM) (see #14289).
  • invalidateblock won't bother to move transactions back into the mempool after 10 blocks (optimization).

Partial Backport of Bitcoin Core PR15402 (commit 1d34287):
https://github.com/bitcoin/bitcoin/pull/15402/commits/1d342875c21b5d0a17cf4d176063bb14b35b657e

Depends on D4669

Test Plan
ninja check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
feature-backport-3db0cc394-1d34287
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8476
Build 14963: Default Diff Build & Tests
Build 14962: arc lint + arc unit

Event Timeline

fpelliccioni retitled this revision from Granular invalidateblock and RewindBlockIndex to Merge the disconnection and erasing loops in RewindBlockIndex.Dec 10 2019, 15:10
fpelliccioni edited the summary of this revision. (Show Details)
fpelliccioni edited the test plan for this revision. (Show Details)
fpelliccioni edited the summary of this revision. (Show Details)

Some small changes, but LGTM

src/validation.cpp
5015

Braces

5034

Put the note on a new line in this comment.

This revision is now accepted and ready to land.Dec 11 2019, 01:20
src/validation.cpp
5015

Oh I thought arc lint do the work for me ;P

markblundeberg added inline comments.
src/validation.cpp
5040

Do we really need this? It seems it is being done in Core for the purpose of witness scrubbing, which doesn't apply to us.