Skip to content

Conversation

sipa
Copy link
Member

@sipa sipa commented Mar 21, 2018

This is an alternative to #11694.

It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.

Also rename the involved variable to modern guidelines, as there are very few uses.

@practicalswift
Copy link
Contributor

Concept ACK! Much better than PR #11694 which I'm now closing :-)

@promag
Copy link
Contributor

promag commented Mar 21, 2018

utACK 42be289.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 42be289df0c277777f7bbfc383ca7520140775cf. Nice simple bugfix.

src/validation.h Outdated
extern CConditionVariable cvBlockChange;
extern CWaitableCriticalSection cs_best_block;
extern CConditionVariable cv_best_block_change;
extern uint256 best_block_hash;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe prefix global variable name with g_. (I would probably call these g_best_block g_best_block_mutex g_best_block_cv.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@sipa sipa force-pushed the 201803_waitblockchange branch from 42be289 to d1cbc67 Compare April 4, 2018 01:02
@promag
Copy link
Contributor

promag commented Apr 4, 2018

utACK d1cbc67a.

@luke-jr
Copy link
Member

luke-jr commented Apr 4, 2018

utACK, although would prefer the renaming was in a separate commit.

@sipa sipa force-pushed the 201803_waitblockchange branch from d1cbc67 to 4a6c0e3 Compare April 4, 2018 04:54
@sipa
Copy link
Member Author

sipa commented Apr 4, 2018

@luke-jr Done.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 4a6c0e3. Only change since last review renaming variables and splitting commit.

@jnewbery
Copy link
Contributor

jnewbery commented Apr 4, 2018

utACK 4a6c0e3

Travis timeout. Kicking.

@sipa sipa merged commit 4a6c0e3 into bitcoin:master Apr 13, 2018
sipa added a commit that referenced this pull request Apr 13, 2018
4a6c0e3 Modernize best block mutex/cv/hash variable naming (Pieter Wuille)
45dd135 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille)

Pull request description:

  This is an alternative to #11694.

  It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.

  Also rename the involved variable to modern guidelines, as there are very few uses.

Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request May 29, 2018
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jul 13, 2018
HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this pull request Jan 11, 2019
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 12, 2020
4a6c0e3 Modernize best block mutex/cv/hash variable naming (Pieter Wuille)
45dd135 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille)

Pull request description:

  This is an alternative to bitcoin#11694.

  It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.

  Also rename the involved variable to modern guidelines, as there are very few uses.

Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 16, 2020
4a6c0e3 Modernize best block mutex/cv/hash variable naming (Pieter Wuille)
45dd135 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille)

Pull request description:

  This is an alternative to bitcoin#11694.

  It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.

  Also rename the involved variable to modern guidelines, as there are very few uses.

Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 16, 2020
4a6c0e3 Modernize best block mutex/cv/hash variable naming (Pieter Wuille)
45dd135 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille)

Pull request description:

  This is an alternative to bitcoin#11694.

  It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.

  Also rename the involved variable to modern guidelines, as there are very few uses.

Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants