-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Serialize in getblock without cs_main #15932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fa59893
to
fab00a5
Compare
Does it make sense to add an |
For reference #12153 (comment). Concept ACK.
Maybe |
Concept ACK. The whole point of moving the lock of |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
utACK faea564 |
Why not use |
Because a scoped lock is more clear and "secure". |
utACK faea564 |
faea564 rpc: Add lock annotations to block{,header}ToJSON (MarcoFalke) fab00a5 rpc: Serialize in getblock without cs_main (MarcoFalke) fa1c359 rpc: Use IsValidNumArgs in getblock (MarcoFalke) Pull request description: No need to hold cs_main when serializing a struct to json Fixes: #15925 ACKs for commit faea56: jnewbery: utACK faea564 jonasschnelli: utACK faea564 Tree-SHA512: 005d378cda1e6024e9f5142f99a8adbefe202cd7bfeaafee55eb909e8990a3790aa27fcf5dd16119cc9afe9dc8bd30f660de40233316781669be166bac3018e7
faea564 rpc: Add lock annotations to block{,header}ToJSON (MarcoFalke) fab00a5 rpc: Serialize in getblock without cs_main (MarcoFalke) fa1c359 rpc: Use IsValidNumArgs in getblock (MarcoFalke) Pull request description: No need to hold cs_main when serializing a struct to json Fixes: bitcoin#15925 ACKs for commit faea56: jnewbery: utACK faea564 jonasschnelli: utACK faea564 Tree-SHA512: 005d378cda1e6024e9f5142f99a8adbefe202cd7bfeaafee55eb909e8990a3790aa27fcf5dd16119cc9afe9dc8bd30f660de40233316781669be166bac3018e7
#include <stdint.h> | ||
#include <vector> | ||
|
||
extern RecursiveMutex cs_main; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarcoFalke Do you use RecursiveMutex
instead of CCriticalSection
on purpose?
…utex e09c701 scripted-diff: Bump copyright of files changed in 2020 (MarcoFalke) 6cbe620 scripted-diff: Replace CCriticalSection with RecursiveMutex (MarcoFalke) Pull request description: `RecursiveMutex` better clarifies that the mutex is recursive, see also the standard library naming: https://en.cppreference.com/w/cpp/thread/recursive_mutex For that reason, and to avoid different people asking me the same question repeatedly (e.g. #15932 (review) ), remove the outdated alias `CCriticalSection` with a scripted-diff ACKs for top commit: Empact: ACK e09c701 diff and scripts look correct promag: ACK e09c701 practicalswift: ACK e09c701 -- scripted diff looks correct Tree-SHA512: 4bd7b5de1befdcf91dc8f43c127a1fee49679e06895a43216f160344a395c8e426dc68d529fbd2d5e1c215625a5a392dc415b1bce4127316aae7ecf98030c855
Summary: bitcoin/bitcoin@fa1c359 --- Partial backport of Core [[bitcoin/bitcoin#15932 | PR15932]] Test Plan: ninja check check-functional run `bitcoin-cli getblock` and check that layout is nice and lined up Reviewers: #bitcoin_abc, nakihito, deadalnix Reviewed By: #bitcoin_abc, nakihito, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6296
Summary: bitcoin/bitcoin@fab00a5 --- Depends on D6296 Partial backport of Core [[bitcoin/bitcoin#15932 | PR15932]] Test Plan: cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug ninja check check-functional Reviewers: #bitcoin_abc, nakihito Reviewed By: nakihito Differential Revision: https://reviews.bitcoinabc.org/D6297
Summary: bitcoin/bitcoin@faea564 --- Depends on D6297 Concludes backport of Core [[bitcoin/bitcoin#15932 | PR15932]] Test Plan: cmake .. -GNinja -DENABLE_SANITIZERS=thread ninja check Reviewers: #bitcoin_abc, nakihito Reviewed By: nakihito Differential Revision: https://reviews.bitcoinabc.org/D6300
zcash: cherry picked from commit fab00a5 zcash: bitcoin/bitcoin#15932
zcash: cherry picked from commit faea564 zcash: bitcoin/bitcoin#15932
faea564 rpc: Add lock annotations to block{,header}ToJSON (MarcoFalke) fab00a5 rpc: Serialize in getblock without cs_main (MarcoFalke) fa1c359 rpc: Use IsValidNumArgs in getblock (MarcoFalke) Pull request description: No need to hold cs_main when serializing a struct to json Fixes: bitcoin#15925 ACKs for commit faea56: jnewbery: utACK faea564 jonasschnelli: utACK faea564 Tree-SHA512: 005d378cda1e6024e9f5142f99a8adbefe202cd7bfeaafee55eb909e8990a3790aa27fcf5dd16119cc9afe9dc8bd30f660de40233316781669be166bac3018e7
faea564 rpc: Add lock annotations to block{,header}ToJSON (MarcoFalke) fab00a5 rpc: Serialize in getblock without cs_main (MarcoFalke) fa1c359 rpc: Use IsValidNumArgs in getblock (MarcoFalke) Pull request description: No need to hold cs_main when serializing a struct to json Fixes: bitcoin#15925 ACKs for commit faea56: jnewbery: utACK faea564 jonasschnelli: utACK faea564 Tree-SHA512: 005d378cda1e6024e9f5142f99a8adbefe202cd7bfeaafee55eb909e8990a3790aa27fcf5dd16119cc9afe9dc8bd30f660de40233316781669be166bac3018e7
faea564 rpc: Add lock annotations to block{,header}ToJSON (MarcoFalke) fab00a5 rpc: Serialize in getblock without cs_main (MarcoFalke) fa1c359 rpc: Use IsValidNumArgs in getblock (MarcoFalke) Pull request description: No need to hold cs_main when serializing a struct to json Fixes: bitcoin#15925 ACKs for commit faea56: jnewbery: utACK faea564 jonasschnelli: utACK faea564 Tree-SHA512: 005d378cda1e6024e9f5142f99a8adbefe202cd7bfeaafee55eb909e8990a3790aa27fcf5dd16119cc9afe9dc8bd30f660de40233316781669be166bac3018e7
No need to hold cs_main when serializing a struct to json
Fixes: #15925