Skip to content

Commit ada2db4

Browse files
authored
triedb/pathdb: move head truncation log (#32649)
Print the `Truncating from head` log only if head truncation is needed.
1 parent 479b803 commit ada2db4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

triedb/pathdb/history.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ func truncateFromHead(store ethdb.AncientStore, typ historyType, nhead uint64) (
176176
if err != nil {
177177
return 0, err
178178
}
179-
log.Info("Truncating from head", "type", typ.String(), "ohead", ohead, "tail", otail, "nhead", nhead)
180-
181179
// Ensure that the truncation target falls within the valid range.
182180
if ohead < nhead || nhead < otail {
183181
return 0, fmt.Errorf("%w, %s, tail: %d, head: %d, target: %d", errHeadTruncationOutOfRange, typ, otail, ohead, nhead)
@@ -186,6 +184,8 @@ func truncateFromHead(store ethdb.AncientStore, typ historyType, nhead uint64) (
186184
if ohead == nhead {
187185
return 0, nil
188186
}
187+
log.Info("Truncating from head", "type", typ.String(), "ohead", ohead, "tail", otail, "nhead", nhead)
188+
189189
ohead, err = store.TruncateHead(nhead)
190190
if err != nil {
191191
return 0, err

0 commit comments

Comments
 (0)