mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-17 21:31:57 +01:00
Renames PoW Parser to open space for the PoW creator
This commit is contained in:
parent
0f6c3b9a3a
commit
793b3fcd16
@ -26,24 +26,24 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class PoWRankProcessorTest {
|
||||
class PoWRankParserTest {
|
||||
@Test
|
||||
fun setPoW() {
|
||||
assertEquals(26, PoWRankProcessor.calculatePowRankOf("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e"))
|
||||
assertEquals(26, PoWRankParser.calculatePowRankOf("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setPoWIfCommited25() {
|
||||
assertEquals(25, PoWRankProcessor.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 25))
|
||||
assertEquals(25, PoWRankParser.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 25))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setPoWIfCommited26() {
|
||||
assertEquals(26, PoWRankProcessor.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 26))
|
||||
assertEquals(26, PoWRankParser.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 26))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setPoWIfCommited27() {
|
||||
assertEquals(26, PoWRankProcessor.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 27))
|
||||
assertEquals(26, PoWRankParser.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 27))
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ package com.vitorpamplona.quartz.nip13Pow
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
|
||||
fun Event.pow() = PoWRankProcessor.compute(id, tags.commitedPoW())
|
||||
fun Event.pow() = PoWRankParser.compute(id, tags.commitedPoW())
|
||||
|
||||
fun Event.hasPoWTag() = tags.hasPoW()
|
||||
|
||||
@ -34,7 +34,7 @@ fun Event.hasPoWTag() = tags.hasPoW()
|
||||
fun Event.strongPoWOrNull(min: Int = 20): Int? {
|
||||
val commitment = tags.commitedPoW()
|
||||
if (commitment != null) {
|
||||
val pow = PoWRankProcessor.compute(id, commitment)
|
||||
val pow = PoWRankParser.compute(id, commitment)
|
||||
if (pow >= min) {
|
||||
return pow
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ package com.vitorpamplona.quartz.nip13Pow
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.HexKey
|
||||
|
||||
class PoWRankProcessor {
|
||||
class PoWRankParser {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun compute(
|
Loading…
x
Reference in New Issue
Block a user