diff --git a/trie/triedb/pathdb/history.go b/trie/triedb/pathdb/history.go index 6e3f3faaed..7d7cc71f48 100644 --- a/trie/triedb/pathdb/history.go +++ b/trie/triedb/pathdb/history.go @@ -619,7 +619,8 @@ func truncateFromTail(db ethdb.Batcher, freezer *rawdb.ResettableFreezer, ntail } // Ensure that the truncation target falls within the specified range. if otail > ntail || ntail > ohead { - return 0, fmt.Errorf("out of range, tail: %d, head: %d, target: %d", otail, ohead, ntail) + log.Warn("truncate from tail out of range", "tail:", otail, "head:", ohead, "target:", ntail) + return 0, nil } // Short circuit if nothing to truncate. if otail == ntail { diff --git a/trie/triedb/pathdb/history_test.go b/trie/triedb/pathdb/history_test.go index a3257441de..fee8ecdb1e 100644 --- a/trie/triedb/pathdb/history_test.go +++ b/trie/triedb/pathdb/history_test.go @@ -252,8 +252,8 @@ func TestTruncateOutOfRange(t *testing.T) { {0, head + 1, fmt.Errorf("out of range, tail: %d, head: %d, target: %d", tail, head, head+1)}, {0, tail - 1, fmt.Errorf("out of range, tail: %d, head: %d, target: %d", tail, head, tail-1)}, {1, tail, nil}, // nothing to delete - {1, head + 1, fmt.Errorf("out of range, tail: %d, head: %d, target: %d", tail, head, head+1)}, - {1, tail - 1, fmt.Errorf("out of range, tail: %d, head: %d, target: %d", tail, head, tail-1)}, + {1, head + 1, nil}, + {1, tail - 1, nil}, } for _, c := range cases { var gotErr error