Commit b80aaa5f authored by Malena López-Batista's avatar Malena López-Batista

Unify naming

parent 99a7599d
Pipeline #161941488 canceled with stages
in 4 minutes and 31 seconds
......@@ -682,17 +682,17 @@ class TezosNodeClient(
* Constructor: Initialize client with default configuration.
*
* @param baseNodeUrl The path to the remote node
* @param validatorBaseUrl The path to a separate node to verify forging calls. Should be different from [baseNodeUrl].
* @param verifierNodeUrl The path to a separate node to verify forging calls. Should be different from [baseNodeUrl].
* @param debug Log network calls
*/
operator fun invoke(
baseNodeUrl: String,
validatorBaseUrl: String,
verifierNodeUrl: String,
debug: Boolean = false
) = run {
val networkClient = DefaultNetworkClient(baseNodeUrl, debug)
val executor = Executors.newCachedThreadPool()
val forgingService = ForgingService(networkClient, executor, validatorBaseUrl, debug)
val forgingService = ForgingService(networkClient, executor, verifierNodeUrl, debug)
TezosNodeClient(networkClient, executor, forgingService)
}
......
......@@ -19,6 +19,8 @@
*/
package io.camlcase.javatezos.model
import io.camlcase.javatezos.operation.forge.ForgingVerifier
/**
* Kinds of errors
*
......@@ -28,6 +30,11 @@ enum class TezosErrorType {
INTERNAL_ERROR,
INVALID_URL,
LOCAL_FORGING_NOT_SUPPORTED,
/**
* Verifying a forged response failed.
* @see [ForgingVerifier]
*/
FORGING_ERROR,
FAILED_OPERATION,
PREAPPLICATION_ERROR,
......
......@@ -47,19 +47,19 @@ class ForgingService(
) {
/**
* Create a [RemoteForgingService] with [validatorNodeUrl].
* Create a [RemoteForgingService] with [verifierNodeUrl].
*
* @param validatorNodeUrl Endpoint of a separate node for verifying forge responses. Should be different from the one used in [networkClient]
* @param verifierNodeUrl Endpoint of a separate node for verifying forge responses. Should be different from the one used in [networkClient]
* @param executorService to manage network requests and calculations asynchronously.
* @param debug Log network calls
*/
constructor(
networkClient: NetworkClient,
executorService: ExecutorService,
validatorNodeUrl: String,
verifierNodeUrl: String,
debug: Boolean = false
) : this(
RemoteForgingService(networkClient, validatorNodeUrl, executorService, debug),
RemoteForgingService(networkClient, verifierNodeUrl, executorService, debug),
executorService
)
......
......@@ -49,7 +49,7 @@ class RemoteForgingService(
) {
/**
* Use central [networkClient] for forging and provide a [validatorBaseUrl] to create a
* Use central [networkClient] for forging and provide a [verifierNodeUrl] to create a
* new client that will make the unforging calls.
*
* @param executorService to manage network requests and calculations asynchronously.
......@@ -57,13 +57,13 @@ class RemoteForgingService(
*/
constructor(
networkClient: NetworkClient,
validatorBaseUrl: String,
verifierNodeUrl: String,
executorService: ExecutorService,
debug: Boolean = false
) : this(
networkClient,
RemoteForgingVerifier(
DefaultNetworkClient(validatorBaseUrl, debug),
DefaultNetworkClient(verifierNodeUrl, debug),
executorService
),
executorService
......@@ -77,13 +77,13 @@ class RemoteForgingService(
*/
fun remoteForge(payload: OperationPayload, metadata: BlockchainMetadata): CompletableFuture<String?> {
return networkClient.send(ForgeOperationRPC(metadata.blockHash, payload))
.flatMap(executorService) { validateForge(it, payload, metadata) }
.flatMap(executorService) { verifyForge(it, payload, metadata) }
}
/**
* @throws TezosError [TezosErrorType.FORGING_ERROR] If validation couldn't be completed
* @throws TezosError [TezosErrorType.FORGING_ERROR] If verification couldn't be completed
*/
private fun validateForge(
private fun verifyForge(
result: String?,
payload: OperationPayload,
metadata: BlockchainMetadata
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment