mirror of
https://github.com/corda/corda.git
synced 2024-12-22 06:17:55 +00:00
Removed ValidatingClient as notary behaviour is not client configurable
This commit is contained in:
parent
5e6533eb8a
commit
6b97fbb79f
@ -75,9 +75,6 @@ object NotaryProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ValidatingClient(stx: SignedTransaction) : Client(stx)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that the timestamp command is valid (if present) and commits the input state, or returns a conflict
|
* Checks that the timestamp command is valid (if present) and commits the input state, or returns a conflict
|
||||||
* if any of the input states have been previously committed.
|
* if any of the input states have been previously committed.
|
||||||
|
@ -5,7 +5,6 @@ import com.r3corda.core.node.services.ServiceType
|
|||||||
import com.r3corda.core.serialization.SingletonSerializeAsToken
|
import com.r3corda.core.serialization.SingletonSerializeAsToken
|
||||||
import com.r3corda.node.services.api.ServiceHubInternal
|
import com.r3corda.node.services.api.ServiceHubInternal
|
||||||
import com.r3corda.protocols.NotaryProtocol
|
import com.r3corda.protocols.NotaryProtocol
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Notary service acts as the final signer of a transaction ensuring two things:
|
* A Notary service acts as the final signer of a transaction ensuring two things:
|
||||||
@ -16,15 +15,13 @@ import kotlin.reflect.KClass
|
|||||||
*
|
*
|
||||||
* This is the base implementation that can be customised with specific Notary transaction commit protocol.
|
* This is the base implementation that can be customised with specific Notary transaction commit protocol.
|
||||||
*/
|
*/
|
||||||
abstract class NotaryService(markerClass: KClass<out NotaryProtocol.Client>, services: ServiceHubInternal) : SingletonSerializeAsToken() {
|
abstract class NotaryService(services: ServiceHubInternal) : SingletonSerializeAsToken() {
|
||||||
// Do not specify this as an advertised service. Use a concrete implementation.
|
// Do not specify this as an advertised service. Use a concrete implementation.
|
||||||
// TODO: We do not want a service type that cannot be used. Fix the type system abuse here.
|
// TODO: We do not want a service type that cannot be used. Fix the type system abuse here.
|
||||||
object Type : ServiceType("corda.notary")
|
object Type : ServiceType("corda.notary")
|
||||||
|
|
||||||
abstract val logger: org.slf4j.Logger
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
services.registerProtocolInitiator(markerClass) { createProtocol(it) }
|
services.registerProtocolInitiator(NotaryProtocol.Client::class) { createProtocol(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement a factory that specifies the transaction commit protocol for the notary service to use */
|
/** Implement a factory that specifies the transaction commit protocol for the notary service to use */
|
||||||
|
@ -11,11 +11,9 @@ import com.r3corda.protocols.NotaryProtocol
|
|||||||
/** A simple Notary service that does not perform transaction validation */
|
/** A simple Notary service that does not perform transaction validation */
|
||||||
class SimpleNotaryService(services: ServiceHubInternal,
|
class SimpleNotaryService(services: ServiceHubInternal,
|
||||||
val timestampChecker: TimestampChecker,
|
val timestampChecker: TimestampChecker,
|
||||||
val uniquenessProvider: UniquenessProvider) : NotaryService(NotaryProtocol.Client::class, services) {
|
val uniquenessProvider: UniquenessProvider) : NotaryService(services) {
|
||||||
object Type : ServiceType("corda.notary.simple")
|
object Type : ServiceType("corda.notary.simple")
|
||||||
|
|
||||||
override val logger = loggerFor<SimpleNotaryService>()
|
|
||||||
|
|
||||||
override fun createProtocol(otherParty: Party): NotaryProtocol.Service {
|
override fun createProtocol(otherParty: Party): NotaryProtocol.Service {
|
||||||
return NotaryProtocol.Service(otherParty, timestampChecker, uniquenessProvider)
|
return NotaryProtocol.Service(otherParty, timestampChecker, uniquenessProvider)
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,15 @@ import com.r3corda.core.crypto.Party
|
|||||||
import com.r3corda.core.node.services.ServiceType
|
import com.r3corda.core.node.services.ServiceType
|
||||||
import com.r3corda.core.node.services.TimestampChecker
|
import com.r3corda.core.node.services.TimestampChecker
|
||||||
import com.r3corda.core.node.services.UniquenessProvider
|
import com.r3corda.core.node.services.UniquenessProvider
|
||||||
import com.r3corda.core.utilities.loggerFor
|
|
||||||
import com.r3corda.node.services.api.ServiceHubInternal
|
import com.r3corda.node.services.api.ServiceHubInternal
|
||||||
import com.r3corda.protocols.NotaryProtocol
|
|
||||||
import com.r3corda.protocols.ValidatingNotaryProtocol
|
import com.r3corda.protocols.ValidatingNotaryProtocol
|
||||||
|
|
||||||
/** A Notary service that validates the transaction chain of he submitted transaction before committing it */
|
/** A Notary service that validates the transaction chain of he submitted transaction before committing it */
|
||||||
class ValidatingNotaryService(services: ServiceHubInternal,
|
class ValidatingNotaryService(services: ServiceHubInternal,
|
||||||
val timestampChecker: TimestampChecker,
|
val timestampChecker: TimestampChecker,
|
||||||
val uniquenessProvider: UniquenessProvider) : NotaryService(NotaryProtocol.ValidatingClient::class, services) {
|
val uniquenessProvider: UniquenessProvider) : NotaryService(services) {
|
||||||
object Type : ServiceType("corda.notary.validating")
|
object Type : ServiceType("corda.notary.validating")
|
||||||
|
|
||||||
override val logger = loggerFor<ValidatingNotaryService>()
|
|
||||||
|
|
||||||
override fun createProtocol(otherParty: Party): ValidatingNotaryProtocol {
|
override fun createProtocol(otherParty: Party): ValidatingNotaryProtocol {
|
||||||
return ValidatingNotaryProtocol(otherParty, timestampChecker, uniquenessProvider)
|
return ValidatingNotaryProtocol(otherParty, timestampChecker, uniquenessProvider)
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import com.r3corda.core.contracts.Command
|
|||||||
import com.r3corda.core.contracts.DummyContract
|
import com.r3corda.core.contracts.DummyContract
|
||||||
import com.r3corda.core.contracts.TransactionType
|
import com.r3corda.core.contracts.TransactionType
|
||||||
import com.r3corda.core.crypto.DigitalSignature
|
import com.r3corda.core.crypto.DigitalSignature
|
||||||
import com.r3corda.core.transactions.SignedTransaction
|
|
||||||
import com.r3corda.core.node.services.ServiceInfo
|
import com.r3corda.core.node.services.ServiceInfo
|
||||||
|
import com.r3corda.core.transactions.SignedTransaction
|
||||||
import com.r3corda.core.utilities.DUMMY_NOTARY
|
import com.r3corda.core.utilities.DUMMY_NOTARY
|
||||||
import com.r3corda.core.utilities.DUMMY_NOTARY_KEY
|
import com.r3corda.core.utilities.DUMMY_NOTARY_KEY
|
||||||
import com.r3corda.node.services.network.NetworkMapService
|
import com.r3corda.node.services.network.NetworkMapService
|
||||||
@ -48,7 +48,7 @@ class ValidatingNotaryServiceTests {
|
|||||||
tx.toSignedTransaction(false)
|
tx.toSignedTransaction(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
val future = runValidatingClient(stx)
|
val future = runClient(stx)
|
||||||
|
|
||||||
val ex = assertFailsWith(ExecutionException::class) { future.get() }
|
val ex = assertFailsWith(ExecutionException::class) { future.get() }
|
||||||
val notaryError = (ex.cause as NotaryException).error
|
val notaryError = (ex.cause as NotaryException).error
|
||||||
@ -66,7 +66,7 @@ class ValidatingNotaryServiceTests {
|
|||||||
tx.toSignedTransaction(false)
|
tx.toSignedTransaction(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
val future = runValidatingClient(stx)
|
val future = runClient(stx)
|
||||||
|
|
||||||
val ex = assertFailsWith(ExecutionException::class) { future.get() }
|
val ex = assertFailsWith(ExecutionException::class) { future.get() }
|
||||||
val notaryError = (ex.cause as NotaryException).error
|
val notaryError = (ex.cause as NotaryException).error
|
||||||
@ -76,8 +76,8 @@ class ValidatingNotaryServiceTests {
|
|||||||
assertEquals(setOf(expectedMissingKey), missingKeys)
|
assertEquals(setOf(expectedMissingKey), missingKeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun runValidatingClient(stx: SignedTransaction): ListenableFuture<DigitalSignature.LegallyIdentifiable> {
|
private fun runClient(stx: SignedTransaction): ListenableFuture<DigitalSignature.LegallyIdentifiable> {
|
||||||
val protocol = NotaryProtocol.ValidatingClient(stx)
|
val protocol = NotaryProtocol.Client(stx)
|
||||||
val future = clientNode.services.startProtocol("notary", protocol)
|
val future = clientNode.services.startProtocol("notary", protocol)
|
||||||
net.runNetwork()
|
net.runNetwork()
|
||||||
return future
|
return future
|
||||||
|
Loading…
Reference in New Issue
Block a user