aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-06-23 18:32:28 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-06-23 18:32:35 +0200
commit7317e14a44c6efc545e6fb9bcedee7174e93a8fa (patch)
tree7acfd04611c899e41816f8506fd060f63d46ab78 /src/test
parentc0e30933e0d319eda6aa8a7f01df32fbb0c3ead8 (diff)
parent7ad414f4bfa74595ee5726e66f3527045c02a977 (diff)
downloadbitcoin-7317e14a44c6efc545e6fb9bcedee7174e93a8fa.tar.xz
Merge bitcoin/bitcoin#22263: refactor: wrap CCoinsViewCursor in unique_ptr
7ad414f4bfa74595ee5726e66f3527045c02a977 doc: add comment about CCoinsViewDBCursor constructor (James O'Beirne) 0f8a5a4dd530549d37c43da52c923ac3b2af1a03 move-only(ish): don't expose CCoinsViewDBCursor (James O'Beirne) 615c1adfb07b9b466173166dc2e53ace540e4b32 refactor: 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 ACK 7ad414f4bfa74595ee5726e66f3527045c02a977 🔎 jonatack: re-ACK 7ad414f4bfa74595ee5726e66f3527045c02a977 modulo suggestion ryanofsky: Code review ACK 7ad414f4bfa74595ee5726e66f3527045c02a977. Two new commits look good and thanks for clarifying constructor comment Tree-SHA512: 6471d03e2de674d84b1ea0d31e25f433d52aa1aa4996f7b4aab1bd02b6bc340b15e64cc8ea07bbefefa3b5da35384ca5400cc230434e787c30931b8574c672f9
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/coins_view.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/fuzz/coins_view.cpp b/src/test/fuzz/coins_view.cpp
index 42f19d16c6..f452696689 100644
--- a/src/test/fuzz/coins_view.cpp
+++ b/src/test/fuzz/coins_view.cpp
@@ -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();