Refactor to utilize Kotlin features

This commit is contained in:
2018-02-16 17:04:08 +01:00
parent b93f382ccd
commit fab1c06135
7 changed files with 92 additions and 53 deletions

View File

@ -89,12 +89,7 @@ class CryptographyTest {
stream = 1
)
val waiter = CallbackWaiter<ByteArray>()
crypto.doProofOfWork(objectMessage, 1000, 1000,
object : ProofOfWorkEngine.Callback {
override fun onNonceCalculated(initialHash: ByteArray, nonce: ByteArray) {
waiter.setValue(nonce)
}
})
crypto.doProofOfWork(objectMessage, 1000, 1000) { _, nonce -> waiter.setValue(nonce) }
objectMessage.nonce = waiter.waitForValue()
try {
crypto.checkProofOfWork(objectMessage, 1000, 1000)