Revert save not enriched to cache (#163)
This commit is contained in:
@@ -39,9 +39,9 @@ open class BlocksMemCache(
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun add(block: BlockContainer) {
|
open fun add(block: BlockContainer) {
|
||||||
if (!block.enriched) {
|
// if (!block.enriched) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
mapping.put(block.hash, block)
|
mapping.put(block.hash, block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,22 +89,22 @@ class BlocksMemCacheSpec extends Specification {
|
|||||||
act1 == null
|
act1 == null
|
||||||
}
|
}
|
||||||
|
|
||||||
def "Try add not full block and read"() {
|
// def "Try add not full block and read"() {
|
||||||
setup:
|
// setup:
|
||||||
def cache = new BlocksMemCache()
|
// def cache = new BlocksMemCache()
|
||||||
def block = new BlockJson<TransactionRefJson>()
|
// def block = new BlockJson<TransactionRefJson>()
|
||||||
block.number = 100
|
// block.number = 100
|
||||||
block.hash = BlockHash.from(hash1)
|
// block.hash = BlockHash.from(hash1)
|
||||||
block.totalDifficulty = BigInteger.ONE
|
// block.totalDifficulty = BigInteger.ONE
|
||||||
block.timestamp = Instant.now().truncatedTo(ChronoUnit.SECONDS)
|
// block.timestamp = Instant.now().truncatedTo(ChronoUnit.SECONDS)
|
||||||
block.uncles = []
|
// block.uncles = []
|
||||||
block.transactions = []
|
// block.transactions = []
|
||||||
|
//
|
||||||
when:
|
// when:
|
||||||
cache.add(BlockContainer.from(block))
|
// cache.add(BlockContainer.from(block))
|
||||||
def act = cache.read(BlockId.from(hash1)).block()
|
// def act = cache.read(BlockId.from(hash1)).block()
|
||||||
then:
|
// then:
|
||||||
act == null
|
// act == null
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user