Issue: #10905
First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines.
Issue: #10905
By returning the result, a few useless lines can be removed.
Return-value-optimization means there should be no copy.
Issue: #10905
161 | @@ -162,28 +162,26 @@ class CCryptoKeyStore : public CBasicKeyStore
162 | {
163 | {
Could this scope level be removed alongside with the return false in the end, or am I missing something about how LOCK works?
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 setAddress pass by reference was a humble try to keep the memory control on the caller side and have it properly cleaned. But seems not to be done well.
The lock in GetKeys is definitively missing. Also, the IsCrypted() method is sometimes called without the cs_KeyStore so, fUseCrypto should be turned into an atomic.
It was never a problem because – at the moment – GetKeys get only called when holding cs_main/cs_wallet.
utACK fe09b0197c20dc3c0a614c1a94dac708ef206743
utACK fe09b0197c20dc3c0a614c1a94dac708ef206743. As @jonasschnelli points out we need to also fix fUseCrypto to either be atomic or under the lock.
Tested ACK fe09b0197c20dc3c0a614c1a94dac708ef206743 Ready for merge. Another pair of eyes would be good.