From ba002c6703de4ed02eaebbd0fee193d58711bd67 Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Mon, 22 Jan 2024 01:23:36 +0700 Subject: [PATCH] Use temp function --- nano/core_test/node.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index 16fae84160..64cfc8a25f 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -645,8 +645,14 @@ TEST (node, fork_publish_inactive) ASSERT_EQ (nano::process_result::fork, node.process_local (send2).value ().code); ASSERT_TIMELY_EQ (5s, election->blocks ().size (), 2); - ASSERT_TRUE (election->blocks ().end () != election->blocks ().find (send1->hash ())); - ASSERT_TRUE (election->blocks ().end () != election->blocks ().find (send2->hash ())); + + auto find_block = [&election] (nano::block_hash hash_a) -> bool { + auto blocks = election->blocks (); + return blocks.end () != blocks.find (hash_a); + }; + ASSERT_TRUE (find_block (send1->hash ())); + ASSERT_TRUE (find_block (send2->hash ())); + ASSERT_EQ (election->winner ()->hash (), send1->hash ()); ASSERT_NE (election->winner ()->hash (), send2->hash ()); }