RewindBlockIndex reads chainActive (via ChainActive()) without holding cs_main #15980

issue practicalswift opened this issue on May 8, 2019
  1. practicalswift commented at 8:26 AM on May 8, 2019: contributor

    RewindBlockIndex reads chainActive (via ChainActive()) without holding cs_main:

    https://github.com/bitcoin/bitcoin/blob/b2a6b0216192b6e8428f1a80b47f5178fccb961a/src/validation.cpp#L4314-L4331

    (Please note that callers of RewindBlockIndex are not allowed to hold cs_main since RewindBlockIndex indirectly calls LimitValidationInterfaceQueue.)

  2. fanquake added the label Validation on May 9, 2019
  3. promag commented at 9:06 PM on May 9, 2019: member

    I think g_chainstate.RewindBlockIndex(params) could return false if ::ChainActive().Tip() == nullptr, then L4319 could be removed.

    So ChainActive() should require cs_main? There's a ton of places where ::ChainActive() is called without the lock..

  4. MarcoFalke added this to the milestone 0.19.0 on May 10, 2019
  5. MarcoFalke referenced this in commit 1c177c3a00 on May 22, 2019
  6. MarcoFalke closed this on May 22, 2019

  7. sidhujag referenced this in commit 438cefda5f on May 24, 2019
  8. MarcoFalke locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-16 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me