mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 15:39:05 +01:00
Merge bitcoin/bitcoin#22263: refactor: wrap CCoinsViewCursor in unique_ptr
7ad414f4bfdoc: add comment about CCoinsViewDBCursor constructor (James O'Beirne)0f8a5a4dd5move-only(ish): don't expose CCoinsViewDBCursor (James O'Beirne)615c1adfb0refactor: wrap CCoinsViewCursor in unique_ptr (James O'Beirne) Pull request description: I tripped over this one for a few hours at the beginning of the week, so I've sort of got a personal vendetta against `CCoinsView::Cursor()` returning a raw pointer. Specifically in the case of CCoinsViewDB, if a raw cursor is allocated and not freed, a cryptic leveldb assertion failure occurs on CCoinsViewDB destruction (`Assertion 'dummy_versions_.next_ == &dummy_versions_' failed.`). This is a pretty simple change. Related to: https://github.com/bitcoin/bitcoin/issues/21766 See also: https://github.com/google/leveldb/issues/142#issuecomment-414418135 ACKs for top commit: MarcoFalke: review ACK7ad414f4bf🔎 jonatack: re-ACK7ad414f4bfmodulo suggestion ryanofsky: Code review ACK7ad414f4bf. Two new commits look good and thanks for clarifying constructor comment Tree-SHA512: 6471d03e2de674d84b1ea0d31e25f433d52aa1aa4996f7b4aab1bd02b6bc340b15e64cc8ea07bbefefa3b5da35384ca5400cc230434e787c30931b8574c672f9
This commit is contained in:
@@ -183,8 +183,8 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view)
|
||||
}
|
||||
|
||||
{
|
||||
const CCoinsViewCursor* coins_view_cursor = backend_coins_view.Cursor();
|
||||
assert(coins_view_cursor == nullptr);
|
||||
std::unique_ptr<CCoinsViewCursor> coins_view_cursor = backend_coins_view.Cursor();
|
||||
assert(!coins_view_cursor);
|
||||
(void)backend_coins_view.EstimateSize();
|
||||
(void)backend_coins_view.GetBestBlock();
|
||||
(void)backend_coins_view.GetHeadBlocks();
|
||||
|
||||
Reference in New Issue
Block a user