From f0d010db88c88fc6426be8a9426ecfe2c54288f5 Mon Sep 17 00:00:00 2001 From: Wesley Shillingford Date: Tue, 22 Oct 2019 17:54:37 +0100 Subject: [PATCH] ASAN error in vote_by_hash test (#2356) --- nano/core_test/node.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index 516adb33..78771231 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -2486,12 +2486,13 @@ TEST (node, vote_republish) TEST (node, vote_by_hash_bundle) { + // Keep max_hashes above system to ensure it is kept in scope as votes can be added during system destruction + std::atomic max_hashes{ 0 }; nano::system system (24000, 1); system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv); nano::keypair key1; system.wallet (0)->insert_adhoc (key1.prv); - std::atomic max_hashes{ 0 }; system.nodes[0]->observers.vote.add ([&max_hashes](std::shared_ptr vote_a, std::shared_ptr channel_a) { if (vote_a->blocks.size () > max_hashes) {