Revert save not enriched to cache (#163)

This commit is contained in:
KirillPamPam
2023-03-16 18:07:40 +04:00
committed by GitHub
parent a0dfb86c54
commit f7451c54eb
2 changed files with 20 additions and 20 deletions

View File

@@ -39,9 +39,9 @@ open class BlocksMemCache(
}
open fun add(block: BlockContainer) {
if (!block.enriched) {
return
}
// if (!block.enriched) {
// return
// }
mapping.put(block.hash, block)
}

View File

@@ -89,22 +89,22 @@ class BlocksMemCacheSpec extends Specification {
act1 == null
}
def "Try add not full block and read"() {
setup:
def cache = new BlocksMemCache()
def block = new BlockJson<TransactionRefJson>()
block.number = 100
block.hash = BlockHash.from(hash1)
block.totalDifficulty = BigInteger.ONE
block.timestamp = Instant.now().truncatedTo(ChronoUnit.SECONDS)
block.uncles = []
block.transactions = []
when:
cache.add(BlockContainer.from(block))
def act = cache.read(BlockId.from(hash1)).block()
then:
act == null
}
// def "Try add not full block and read"() {
// setup:
// def cache = new BlocksMemCache()
// def block = new BlockJson<TransactionRefJson>()
// block.number = 100
// block.hash = BlockHash.from(hash1)
// block.totalDifficulty = BigInteger.ONE
// block.timestamp = Instant.now().truncatedTo(ChronoUnit.SECONDS)
// block.uncles = []
// block.transactions = []
//
// when:
// cache.add(BlockContainer.from(block))
// def act = cache.read(BlockId.from(hash1)).block()
// then:
// act == null
// }
}