Skip to content

Commit

Permalink
Revert save not enriched to cache (emeraldpay#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillPamPam authored Mar 16, 2023
1 parent a0dfb86 commit f7451c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
// }

}

0 comments on commit f7451c5

Please sign in to comment.