Skip to content

Commit

Permalink
Merge branch 'version-1.5.x' into refactor-network-server
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot authored Jun 11, 2024
2 parents c85d0cc + fcb9215 commit 13f625a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.google.common.cache.CacheBuilder
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.lang.ValidationError
import com.wavesplatform.network.InvalidBlockStorageImpl.*
import com.wavesplatform.transaction.TxValidationError.BlockFromFuture

import scala.concurrent.duration.FiniteDuration

Expand All @@ -26,7 +27,11 @@ class InvalidBlockStorageImpl(settings: InvalidBlockStorageSettings) extends Inv
.expireAfterWrite(settings.timeout.length, settings.timeout.unit)
.build[ByteStr, ValidationError]()

override def add(blockId: ByteStr, validationError: ValidationError): Unit = cache.put(blockId, validationError)
override def add(blockId: ByteStr, validationError: ValidationError): Unit =
validationError match {
case _: BlockFromFuture => // ignore because it's a temporary error
case _ => cache.put(blockId, validationError)
}

override def find(blockId: ByteStr): Option[ValidationError] = Option(cache.getIfPresent(blockId))
}
Expand Down

0 comments on commit 13f625a

Please sign in to comment.