HomePhabricator

Make last disconnected block BLOCK_FAILED_VALID, even when aborted

Description

Make last disconnected block BLOCK_FAILED_VALID, even when aborted

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 519b0bc):
https://github.com/bitcoin/bitcoin/pull/15402/commits/519b0bc5dc5155b6f7e2362c2105552bb7618ad0

Make last disconnected block BLOCK_FAILED_VALID, even when aborted

Depends on D4804

Test Plan:

ninja check-all

Reviewers: #bitcoin_abc, deadalnix, markblundeberg, Fabien

Reviewed By: #bitcoin_abc, deadalnix, markblundeberg

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

Details

Provenance
Pieter Wuille <pieter.wuille@gmail.com>Authored on Jan 20 2020, 15:41
fpelliccioniCommitted on Jan 21 2020, 21:45
FabienPushed on Jan 22 2020, 10:57
Reviewer
Restricted Project
Differential Revision
D4929: Make last disconnected block BLOCK_FAILED_VALID, even when aborted
Parents
rSTAGINGd3cdd0f3b3f6: Use trivial algorithm in ecmult_multi if scratch space is small
Branches
Unknown
Tags
Unknown