Merge #7913: Fix for incorrect locking in GetPubKey() (keystore.cpp)