From e89f93ff8509a783addd90ea70a10e048f66bcfd Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sun, 20 Jun 2021 22:48:10 +0100 Subject: [PATCH] test: Add test case for popping from an empty history tree --- src/gtest/test_history.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gtest/test_history.cpp b/src/gtest/test_history.cpp index 537db2196..28ad5be15 100644 --- a/src/gtest/test_history.cpp +++ b/src/gtest/test_history.cpp @@ -174,6 +174,10 @@ TEST(History, EpochBoundaries) { view.PopHistoryNode(epoch2); EXPECT_EQ(view.GetHistoryLength(epoch2), 0); + // Trying to truncate an empty tree is a no-op + view.PopHistoryNode(epoch2); + EXPECT_EQ(view.GetHistoryLength(epoch2), 0); + } TEST(History, GarbageMemoryHash) {