mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-03 23:02:55 +00:00
triedb/pathdb: move head truncation log (#32649)
Print the `Truncating from head` log only if head truncation is needed.
This commit is contained in:
parent
479b8031dc
commit
ada2db4304
1 changed files with 2 additions and 2 deletions
|
|
@ -176,8 +176,6 @@ func truncateFromHead(store ethdb.AncientStore, typ historyType, nhead uint64) (
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
log.Info("Truncating from head", "type", typ.String(), "ohead", ohead, "tail", otail, "nhead", nhead)
|
|
||||||
|
|
||||||
// Ensure that the truncation target falls within the valid range.
|
// Ensure that the truncation target falls within the valid range.
|
||||||
if ohead < nhead || nhead < otail {
|
if ohead < nhead || nhead < otail {
|
||||||
return 0, fmt.Errorf("%w, %s, tail: %d, head: %d, target: %d", errHeadTruncationOutOfRange, typ, otail, ohead, nhead)
|
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) (
|
||||||
if ohead == nhead {
|
if ohead == nhead {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
log.Info("Truncating from head", "type", typ.String(), "ohead", ohead, "tail", otail, "nhead", nhead)
|
||||||
|
|
||||||
ohead, err = store.TruncateHead(nhead)
|
ohead, err = store.TruncateHead(nhead)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue