NewIterator()
when GetBestBlock()
throws an exception. (When compiled with clang, the parameters are evaluated from left to right)
NewIterator()
when GetBestBlock()
throws an exception. (When compiled with clang, the parameters are evaluated from left to right)
Isn’t this solved by std::make_unique already? #22263 (review)
Edit: Oh never mind, it is not.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
No conflicts as of last run.
Edit: Oh never mind, it is not.
Right, it there would be no need for this PR if CDBWrapper::NewIterator()
would return std::unique_ptr
.
169@@ -170,7 +170,8 @@ bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
170
171 CCoinsViewCursor *CCoinsViewDB::Cursor() const
172 {
173- CCoinsViewDBCursor *i = new CCoinsViewDBCursor(const_cast<CDBWrapper&>(*m_db).NewIterator(), GetBestBlock());
174+ uint256 hashBestChain = GetBestBlock();
169@@ -170,7 +170,8 @@ bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
170
171 CCoinsViewCursor *CCoinsViewDB::Cursor() const
172 {
173- CCoinsViewDBCursor *i = new CCoinsViewDBCursor(const_cast<CDBWrapper&>(*m_db).NewIterator(), GetBestBlock());
174+ uint256 hashBestChain = GetBestBlock();
175+ CCoinsViewDBCursor *i = new CCoinsViewDBCursor(const_cast<CDBWrapper&>(*m_db).NewIterator(), hashBestChain);
* const i
if we are changing that line in any case :) . Pointer itself is never changed in the function.