validation: Add compile-time checking for negative locking requirement in LimitValidationInterfaceQueue #15971

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:negative-locks changing 2 files +6 −6
  1. practicalswift commented at 9:36 AM on May 7, 2019: contributor

    This PR adds compile-time checking for negative locking requirements that follow from the run-time locking requirement AssertLockNotHeld(cs_main) in LimitValidationInterfaceQueue(...).

    Changes:

    • Add LOCKS_EXCLUDED(cs_main) to LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
    • Add LOCKS_EXCLUDED(cs_main) to CChainState::ActivateBestChain(…), CChainState:: InvalidateBlock(…) and CChainState::RewindBlockIndex(…) which all call LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
    • Add LOCKS_EXCLUDED(cs_main) to InvalidateBlock(…) which calls CChainState::InvalidateBlock(...) which in turn calls LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
    • Add LOCKS_EXCLUDED(cs_main) to RewindBlockIndex(…) which calls CChainState::RewindBlockIndex(...) which in turn calls LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
  2. fanquake added the label Validation on May 7, 2019
  3. practicalswift renamed this:
    validation: Add compile-time checking for negative locking requirements in LimitValidationInterfaceQueue
    validation: Add compile-time checking for negative locking requirement in LimitValidationInterfaceQueue
    on May 7, 2019
  4. DrahtBot commented at 9:49 AM on May 7, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #15976 (refactor: move methods under CChainState (pt. 1) by jamesob)
    • #15921 (Tidy up ValidationState interface by jnewbery)
    • #15606 ([experimental] UTXO snapshots by jamesob)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  5. MarcoFalke commented at 6:47 PM on May 7, 2019: member

    Could squash the 6-line patch into one commit?

  6. Add LOCKS_EXCLUDED(cs_main) to LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
    Add LOCKS_EXCLUDED(cs_main) to functions calling LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
    
    Add LOCKS_EXCLUDED(cs_main) to functions calling CChainState::InvalidateBlock(...) which calls LimitValidationInterfaceQueue(...) which in turn does AssertLockNotHeld(cs_main)
    
    Add LOCKS_EXCLUDED(cs_main) to functions calling CChainState::RewindBlockIndex(...) which calls LimitValidationInterfaceQueue(...) which in turn does AssertLockNotHeld(cs_main)
    62d50ef308
  7. practicalswift force-pushed on May 8, 2019
  8. practicalswift commented at 8:33 AM on May 8, 2019: contributor

    @MarcoFalke Good idea! Now squashed. Please re-review :-)

  9. MarcoFalke commented at 1:07 PM on May 8, 2019: member

    utACK 62d50ef308

    <details><summary>Show signature and timestamp</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    utACK 62d50ef308
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUim4Av/RLUDl9SDFcOuGM5cBlpQmyQQKIBgVzKydburyLKhFCm8jnBEELyuercc
    dka91GjGW2NCaeHXZInwjKQbuXytrjvdwdt19OW0x1YESGRaKQGiTXzSaTBXXtWd
    INHkoIoXR8X0lmMFC6aKv+euGh+ZijHIIUp0xwJym4uOVlEPN4eu0LPg1f43RebC
    N+Pu1+WETQZN+slBPMys9+dc7HXq2U2CS3Rim6Jkn/UCbGOnpeq4fDE8SX3v5ZEb
    TfT+XZR+tQx4dQk48MmCdNPv/Ey+81B2h8ceNkcZTNcz/NJ6qs+ozqOw54LHuEEK
    Eb9pLOnvyR2ilhSVZZ4Cpu6UZxexYqaiByIXUj7zeuj5HSqEAh/fncTI974NvxNB
    qGvKFDIIbu6RWVlgNucp5G83OOHti8qhniPkmiBNYqfmDckeWae/l/S8ana7sEP1
    Ou1eUp1h1jbEoxc96/vdeEIbaUrCxzyr2qhIZcvUQxfYJ2m8wD5ADAkhSsYZoNHZ
    E0YHdHaq
    =66rs
    -----END PGP SIGNATURE-----
    

    Timestamp of file with hash bda0ebcaa8c906a633271bd3b89c8167474a1a46bfec01511af80cc4bb5a4bb5 -

    </details>

  10. MarcoFalke merged this on May 8, 2019
  11. MarcoFalke closed this on May 8, 2019

  12. MarcoFalke referenced this in commit 49c1aa5f83 on May 8, 2019
  13. jamesob commented at 9:03 PM on May 8, 2019: member

    This causes a warning during compilation because we call ABC here with cs_main held: https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L3953-L3962

  14. MarcoFalke commented at 9:22 PM on May 8, 2019: member

    @jamesob This issue is reported in

    • Inconsistent locking behavior in LoadChainTip #15967
  15. jasonbcox referenced this in commit f432e7ff62 on Jul 14, 2020
  16. jasonbcox referenced this in commit e249e28b3f on Aug 21, 2020
  17. practicalswift deleted the branch on Apr 10, 2021
  18. Munkybooty referenced this in commit b6c2717a88 on Oct 16, 2021
  19. Munkybooty referenced this in commit 1795ed6ec3 on Oct 22, 2021
  20. Munkybooty referenced this in commit 197bc026cc on Oct 23, 2021
  21. Munkybooty referenced this in commit 29904120b0 on Oct 26, 2021
  22. UdjinM6 referenced this in commit 847a75ba4a on Oct 29, 2021
  23. pravblockc referenced this in commit 60404767c6 on Nov 18, 2021
  24. DrahtBot locked this on Aug 16, 2022

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-14 21:14 UTC

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