diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -258,11 +258,13 @@ class ChainImpl : public Chain { public: std::unique_ptr lock(bool try_lock) override { - auto result = std::make_unique( + auto lock = std::make_unique( ::cs_main, "cs_main", __FILE__, __LINE__, try_lock); - if (try_lock && result && !*result) { + if (try_lock && lock && !*lock) { return {}; } + std::unique_ptr result = + std::move(lock); // Temporary to avoid CWG 1579 return result; } bool findBlock(const BlockHash &hash, CBlock *block, int64_t *time,