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
add missing lock to crypter GetKeys() #10916
Conversation
Issue: bitcoin#10905 By returning the result, a few useless lines can be removed. Return-value-optimization means there should be no copy.
@@ -162,28 +162,26 @@ class CCryptoKeyStore : public CBasicKeyStore | |||
{ | |||
{ |
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.
Could this scope level be removed alongside with the return false
in the end, or am I missing something about how LOCK
works?
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.
It certainly looks like it. The lock goes out of scope either way, and that last return is unreachable as it stands now
I guess the The lock in It was never a problem because – at the moment – GetKeys get only called when holding cs_main/cs_wallet. utACK fe09b01 |
utACK fe09b01. As @jonasschnelli points out we need to also fix fUseCrypto to either be atomic or under the lock. |
Tested ACK fe09b01 |
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: #10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
Issue: #10905 By returning the result, a few useless lines can be removed. Return-value-optimization means there should be no copy. zcash: cherry picked from commit 5cb3da0 zcash: bitcoin/bitcoin#10916
Bitcoin 0.16 locking PRs These are locking changes from upstream (bitcoin core) release 0.16 (Aug 14, 2017, to Feb 16, 2018), oldest to newest (when merged to the master branch). Each commit also includes a reference both to the PR and the upstream commit. - bitcoin/bitcoin#11126 - Excludes changes to wallet tests that we don't have. - bitcoin/bitcoin#10916 - first commit only; second commit already merged by d9fcc2b - bitcoin/bitcoin#11107 - Only the last commit. - bitcoin/bitcoin#11593 - bitcoin/bitcoin#11585 - bitcoin/bitcoin#11618 - bitcoin/bitcoin#10286 - Only the third and last commits. - bitcoin/bitcoin#11870 - bitcoin/bitcoin#12330 - bitcoin/bitcoin#12366 - bitcoin/bitcoin#12368 - bitcoin/bitcoin#12333 - Only the first commit.
fe09b01 add missing lock to crypter GetKeys() (Marko Bencun) 5cb3da0 keystore GetKeys(): return result instead of writing to reference (Marko Bencun) Pull request description: Issue: bitcoin#10905 First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines. Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
Issue: #10905
First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines.