HomePhabricator

Optimization: don't add txn back to mempool after 10 invalidates

Description

Optimization: don't add txn back to mempool after 10 invalidates

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 8d22041):
https://github.com/bitcoin/bitcoin/pull/15402/commits/8d220417cd7bc34464e28a4861a885193ec091c2

Optimization: don't add txn back to mempool after 10 invalidates

Depends on D4803

Test Plan:

ninja check-all

Reviewers: #bitcoin_abc, deadalnix, markblundeberg

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
Pieter Wuille <pieter.wuille@gmail.com>Authored on Feb 14 2019, 02:07
fpelliccioniCommitted on Jan 15 2020, 17:37
fpelliccioniPushed on Jan 15 2020, 17:37
Reviewer
Restricted Project
Differential Revision
D4804: Optimization: don't add txn back to mempool after 10 invalidates
Parents
rABCa64accabc34c: [CI] Use ninja targets instead of calling binaries
Branches
Unknown
Tags
Unknown