mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-28 18:51:45 +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
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class PoWRankProcessorTest {
|
class PoWRankParserTest {
|
||||||
@Test
|
@Test
|
||||||
fun setPoW() {
|
fun setPoW() {
|
||||||
assertEquals(26, PoWRankProcessor.calculatePowRankOf("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e"))
|
assertEquals(26, PoWRankParser.calculatePowRankOf("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setPoWIfCommited25() {
|
fun setPoWIfCommited25() {
|
||||||
assertEquals(25, PoWRankProcessor.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 25))
|
assertEquals(25, PoWRankParser.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 25))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setPoWIfCommited26() {
|
fun setPoWIfCommited26() {
|
||||||
assertEquals(26, PoWRankProcessor.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 26))
|
assertEquals(26, PoWRankParser.compute("00000026c91e9fc75fdb95b367776e2594b931cebda6d5ca3622501006669c9e", 26))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setPoWIfCommited27() {
|
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
|
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()
|
fun Event.hasPoWTag() = tags.hasPoW()
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ fun Event.hasPoWTag() = tags.hasPoW()
|
|||||||
fun Event.strongPoWOrNull(min: Int = 20): Int? {
|
fun Event.strongPoWOrNull(min: Int = 20): Int? {
|
||||||
val commitment = tags.commitedPoW()
|
val commitment = tags.commitedPoW()
|
||||||
if (commitment != null) {
|
if (commitment != null) {
|
||||||
val pow = PoWRankProcessor.compute(id, commitment)
|
val pow = PoWRankParser.compute(id, commitment)
|
||||||
if (pow >= min) {
|
if (pow >= min) {
|
||||||
return pow
|
return pow
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ package com.vitorpamplona.quartz.nip13Pow
|
|||||||
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.HexKey
|
import com.vitorpamplona.quartz.nip01Core.HexKey
|
||||||
|
|
||||||
class PoWRankProcessor {
|
class PoWRankParser {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun compute(
|
fun compute(
|
Loading…
x
Reference in New Issue
Block a user