From f7451c54eb018671a08a8b390605336ed788070f Mon Sep 17 00:00:00 2001 From: KirillPamPam Date: Thu, 16 Mar 2023 18:07:40 +0400 Subject: [PATCH] Revert save not enriched to cache (#163) --- .../dshackle/cache/BlocksMemCache.kt | 6 ++-- .../dshackle/cache/BlocksMemCacheSpec.groovy | 34 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/cache/BlocksMemCache.kt b/src/main/kotlin/io/emeraldpay/dshackle/cache/BlocksMemCache.kt index 5d3671a8..be05901d 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/cache/BlocksMemCache.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/cache/BlocksMemCache.kt @@ -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) } diff --git a/src/test/groovy/io/emeraldpay/dshackle/cache/BlocksMemCacheSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/cache/BlocksMemCacheSpec.groovy index a4b6e82b..45df5f5c 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/cache/BlocksMemCacheSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/cache/BlocksMemCacheSpec.groovy @@ -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() - 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() +// 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 +// } }