revert to invalidTipetsCap

This commit is contained in:
maskpp 2024-02-26 15:21:26 +08:00
parent 507f88a513
commit 055237e020

View file

@ -58,9 +58,9 @@ const (
// to be reprocessed again.
invalidBlockHitEviction = 128
// invalidTipetsCap is the max number of recent block hashes tracked that
// invalidTipsetsCap is the max number of recent block hashes tracked that
// have lead to some bad ancestor block. It's just an OOM protection.
invalidTipetsCap = 512
invalidTipsetsCap = 512
// beaconUpdateStartupTimeout is the time to wait for a beacon client to get
// attached before starting to issue warnings.
@ -715,7 +715,7 @@ func (api *ConsensusAPI) checkInvalidAncestor(check common.Hash, head common.Has
// Not too many failures yet, mark the head of the invalid chain as invalid
if check != head {
log.Warn("Marked new chain head as invalid", "hash", head, "badnumber", invalid.Number, "badhash", badHash)
for len(api.invalidTipsets) >= invalidTipetsCap {
for len(api.invalidTipsets) >= invalidTipsetsCap {
for key := range api.invalidTipsets {
delete(api.invalidTipsets, key)
break