From 0663a3d90ce7176e10786fbf698f07e914487c7f Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Fri, 29 Mar 2024 18:30:39 -0400 Subject: [PATCH] Add `num_digests_appended()` method, not used but pretty cool doc on what `mask` means. --- libraries/chain/include/eosio/chain/incremental_merkle.hpp | 6 +++++- unittests/merkle_tree_tests.cpp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/chain/include/eosio/chain/incremental_merkle.hpp b/libraries/chain/include/eosio/chain/incremental_merkle.hpp index 9325e3ed29..0b3d5dd4f4 100644 --- a/libraries/chain/include/eosio/chain/incremental_merkle.hpp +++ b/libraries/chain/include/eosio/chain/incremental_merkle.hpp @@ -19,7 +19,11 @@ class incremental_merkle_tree { return {}; assert(!trees.empty()); return _get_root(0); - }; + } + + uint64_t num_digests_appended() const { + return mask; + } private: friend struct fc::reflector; diff --git a/unittests/merkle_tree_tests.cpp b/unittests/merkle_tree_tests.cpp index c6e26d5d3f..092a5545ba 100644 --- a/unittests/merkle_tree_tests.cpp +++ b/unittests/merkle_tree_tests.cpp @@ -173,8 +173,10 @@ BOOST_AUTO_TEST_CASE(consistency_over_large_range) { std::vector digests = create_test_digests(num_digests); for (size_t i=1; i