Skip to content
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

Avoid permanent cs_main lock in getblockheader #12153

Merged
merged 1 commit into from Jan 8, 2019

Conversation

Projects
None yet
7 participants
@promag
Copy link
Member

commented Jan 11, 2018

This PR reduces the cs_main lock scope in getblockheader RPC.

@promag promag force-pushed the promag:2018-01-getblockheader branch Jan 11, 2018

@promag promag force-pushed the promag:2018-01-getblockheader branch 4 times, most recently Jan 11, 2018

@ryanofsky
Copy link
Contributor

left a comment

utACK last commit only 5e924f4d22a16b0c46d4c6cb19877892331d41fa (previous commits are from base PR)

@jnewbery

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

needs rebase (but probably not worth doing until #12151 is merged)

@promag

This comment has been minimized.

Copy link
Member Author

commented Jan 4, 2019

Rebased.

@fanquake fanquake removed the Needs rebase label Jan 4, 2019

@bitcoin bitcoin deleted a comment from DrahtBot Jan 4, 2019

@bitcoin bitcoin deleted a comment from DrahtBot Jan 4, 2019

@bitcoin bitcoin deleted a comment from DrahtBot Jan 4, 2019

@bitcoin bitcoin deleted a comment from DrahtBot Jan 4, 2019

Show resolved Hide resolved src/rpc/blockchain.cpp Outdated

@promag promag force-pushed the promag:2018-01-getblockheader branch to f12e1d0 Jan 4, 2019

@MarcoFalke

This comment has been minimized.

Copy link
Member

commented Jan 4, 2019

utACK f12e1d0

@ryanofsky
Copy link
Contributor

left a comment

utACK f12e1d0. No change since last review other than rebase.

@MarcoFalke MarcoFalke added this to the 0.18.0 milestone Jan 5, 2019

@laanwj

This comment has been minimized.

Copy link
Member

commented Jan 7, 2019

So to be clear: this is can be done, because it is safe to access the fields on the CBlockIndex instance without the lock?

@promag

This comment has been minimized.

Copy link
Member Author

commented Jan 7, 2019

@laanwj to best of my knowledge yes. Looks like nStatus is the only field that needs the lock, which is not used.

@jnewbery

This comment has been minimized.

Copy link
Member

commented Jan 7, 2019

utACK f12e1d0.

Do you intend to do the same for getblock? Not holding cs_main while reading a block from disk and serializing into json seems like a big win.

@laanwj laanwj merged commit f12e1d0 into bitcoin:master Jan 8, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Jan 8, 2019

Merge #12153: Avoid permanent cs_main lock in getblockheader
f12e1d0 rpc: Avoid permanent cs_main lock in getblockheader (João Barbosa)

Pull request description:

  This PR reduces the `cs_main` lock scope in `getblockheader` RPC.

Tree-SHA512: bc51f80e15d1b32d3c7886836457f9929706b6aad9841dafce31ffca444281471b21b56192bb50de774184b9377412f815ad8d3d2439049a7e64d2e59c415767

@promag promag deleted the promag:2018-01-getblockheader branch Jan 8, 2019

@promag

This comment has been minimized.

Copy link
Member Author

commented Jan 8, 2019

@jnewbery #11913 #13903 are related to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.