[GetTransaction] remove unneeded cs_main lock acquire #22609
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a follow-up to #22383. For reading from the mempool, only
mempool.cs
needs to be locked (see suggestion by MarcoFalke):bitcoin/src/txmempool.h
Lines 554 to 558 in b620b2d
CTxMemPool::get()
acquires this lock:bitcoin/src/txmempool.cpp
Lines 822 to 829 in b620b2d
so we don't need to acquire any lock ourselves in
GetTransaction()
, as the other functions called in the remaining parts also don't need to havecs_main
locked.