Remove redundant run time assertions for locks already checked at compile time #14443

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:remove-redundant-runtime-locking-checks changing 7 files +3 −72
  1. practicalswift commented at 12:21 PM on October 9, 2018: contributor

    Remove redundant run time assertions (AssertLockHeld(foo)) for locks already checked at compile time (EXCLUSIVE_LOCKS_REQUIRED(foo), -Wthread-safety).

    The redundancy can be verified by checking that the function that contains the removed run time assertion has the corresponding compile time check.

    The relevant compile time checks can be listed using:

    git grep -E -A3 '(ImplicitlyLearnRelatedKeyScripts|MaybeSetPeerAsAnnouncingHeaderAndIDs|TipMayBeStale|BlockRequestAllowed|SendRejectsAndCheckIfBanned|ConsiderEviction|IsRBFOptIn|entryToJSON|removeForReorg|GetSortedDepthAndScore|RemoveStaged|trackPackageRemoved|CheckFinalTx|TestLockPointValidity|IsCurrentForFeeEstimation|UpdateMempoolForReorg|CheckInputsFromMempoolAndCache|AcceptToMemoryPoolWorker|CheckForkWarningConditions|CheckForkWarningConditionsOnNewFork|CheckInputs|GetBlockScriptFlags|ConnectBlock|ActivateBestChainStep|InvalidateBlock|ResetBlockFailureFlags|AddToBlockIndex|AcceptBlockHeader|AcceptBlock|TestBlockValidity|InsertBlockIndex|GenerateNewKey|AddKeyPubKeyWithDB|LoadKeyMetadata|LoadScriptMetadata|UpdateTimeFirstKey|RemoveWatchOnly|HasWalletSpend|IncOrderPosNext|AvailableCoins|ListCoins|SignTransaction|ZapSelectTx|KeypoolCountExternalKeys|LoadKeyPool|GetAddressGroupings|MarkReserveKeysAsUsed|LockCoin|UnlockCoin|UnlockAllCoins|IsLockedCoin|ListLockedCoins)' | grep -B3 EXCLUSIVE_LOCKS_REQUIRED
    
  2. Remove redundant run-time lock checking for locking requirements already checked at compile time (-Wthread-safety) b3e34c3af4
  3. fanquake added the label Refactoring on Oct 9, 2018
  4. DrahtBot commented at 2:48 PM on October 9, 2018: member

    <!--e57a25ab6845829454e8d69fc972939a-->Reviewers, this pull request conflicts with the following ones:

    • #14437 (Refactor: Start to separate wallet from node by ryanofsky)
    • #14193 (validation: Add missing mempool locks by MarcoFalke)
    • #13868 (Remove unused fScriptChecks parameter from CheckInputs by Empact)
    • #13804 (Transaction Pool Layer by MarcoFalke)
    • #13204 (Faster sigcache nonce by JeremyRubin)
    • #13189 (Remove 2nd mapTx lookup in CTxMemPool::removeForBlock by promag)
    • #10973 (Refactor: separate wallet from node by ryanofsky)

    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. fanquake commented at 2:32 AM on October 10, 2018: member

    @practicalswift I'm going to close this. @MarcoFalke bought this up here:

    Good point, but I think we want to keep these for now, since not all compilers support these compile-time annotations and sometimes they have to be disabled due to shortcomings.

    I know @TheBlueMatt also holds the opinion that leaving these in is still a good idea, and there is essentially no overhead to doing that.

  6. fanquake closed this on Oct 10, 2018

  7. practicalswift commented at 8:35 AM on October 10, 2018: contributor

    @fanquake Thanks for communicating the rationale clearly. That brings transparency to your maintainer work.

    Since the maintainer role is a commission of trust I think it is crucial that the decision process is clear and that the maintainer is ready to bring clarity if needed by answering questions about his/her decisions.

    FWIW: I think you're doing a great job with labelling the PR:s. I'm continually impressed by how quickly you do the labelling. Talking about that, did you see my curious question in [#14239](/bitcoin-bitcoin/14239/) on how to label PR:s fixing undefined behaviour ("bugs" vs "refactoring")? Not a big issues obviously but it would be nice to have it clarified. More communication is better than less communication when it comes to maintainership :-)

    Thanks!

  8. practicalswift deleted the branch on Apr 10, 2021
  9. 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-13 21:15 UTC

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