mirror of
https://github.com/corda/corda.git
synced 2025-01-17 18:29:49 +00:00
[EG-503] Spent state audit tool (#6107)
* [EG-503] Spent state audit tool Fixes * Refinements to notary query interfaces. Feature complete. * EG-503: Introduce optional `notaryService` in `ServiceHubCoreInternal` * Remove redundant logic following change to use extensions API Co-authored-by: Viktor Kolomeyko <viktor.kolomeyko@r3.com>
This commit is contained in:
parent
27ea570fbb
commit
6a07284324
@ -2,6 +2,7 @@ package net.corda.core.internal
|
||||
|
||||
import co.paralleluniverse.fibers.Suspendable
|
||||
import net.corda.core.DeleteForDJVM
|
||||
import net.corda.core.internal.notary.NotaryService
|
||||
import net.corda.core.node.ServiceHub
|
||||
import net.corda.core.node.StatesToRecord
|
||||
import java.util.concurrent.ExecutorService
|
||||
@ -14,6 +15,11 @@ interface ServiceHubCoreInternal : ServiceHub {
|
||||
|
||||
val attachmentTrustCalculator: AttachmentTrustCalculator
|
||||
|
||||
/**
|
||||
* Optional `NotaryService` which will be `null` for all non-Notary nodes.
|
||||
*/
|
||||
val notaryService: NotaryService?
|
||||
|
||||
fun createTransactionsResolver(flow: ResolveTransactionsFlow): TransactionsResolver
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,19 @@ abstract class NotaryService : SingletonSerializeAsToken() {
|
||||
abstract val services: ServiceHub
|
||||
abstract val notaryIdentityKey: PublicKey
|
||||
|
||||
/**
|
||||
* Interfaces for the request and result formats of queries supported by notary services. To
|
||||
* implement a new query, you must:
|
||||
*
|
||||
* - Define data classes which implement the [Query.Request] and [Query.Result] interfaces
|
||||
* - Add corresponding handling for the new classes within the notary service implementations
|
||||
* that you want to support the query.
|
||||
*/
|
||||
interface Query {
|
||||
interface Request
|
||||
interface Result
|
||||
}
|
||||
|
||||
abstract fun start()
|
||||
abstract fun stop()
|
||||
|
||||
@ -22,4 +35,18 @@ abstract class NotaryService : SingletonSerializeAsToken() {
|
||||
* @param otherPartySession client [Party] making the request
|
||||
*/
|
||||
abstract fun createServiceFlow(otherPartySession: FlowSession): FlowLogic<Void?>
|
||||
|
||||
/**
|
||||
* Processes a [Query.Request] and returns a [Query.Result].
|
||||
*
|
||||
* Note that this always throws an [UnsupportedOperationException] to handle notary
|
||||
* implementations that do not support this functionality. This must be overridden by
|
||||
* notary implementations wishing to support query functionality.
|
||||
*
|
||||
* Overrides of this function may themselves still throw an [UnsupportedOperationException],
|
||||
* if they do not support specific query implementations
|
||||
*/
|
||||
open fun processQuery(query: Query.Request): Query.Result {
|
||||
throw UnsupportedOperationException("Notary has not implemented query support")
|
||||
}
|
||||
}
|
@ -367,6 +367,8 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
||||
|
||||
private val checkpointDumper = CheckpointDumperImpl(checkpointStorage, database, services, services.configuration.baseDirectory)
|
||||
|
||||
private var notaryService: NotaryService? = null
|
||||
|
||||
private val nodeServicesContext = object : NodeServicesContext {
|
||||
override val platformVersion = versionInfo.platformVersion
|
||||
override val configurationWithOptions = configuration.configurationWithOptions
|
||||
@ -524,7 +526,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
||||
// the KMS is meant for derived temporary keys used in transactions, and we're not supposed to sign things with
|
||||
// the identity key. But the infrastructure to make that easy isn't here yet.
|
||||
keyManagementService.start(keyPairs)
|
||||
val notaryService = maybeStartNotaryService(myNotaryIdentity)
|
||||
notaryService = maybeStartNotaryService(myNotaryIdentity)
|
||||
installCordaServices()
|
||||
contractUpgradeService.start()
|
||||
vaultService.start()
|
||||
@ -1160,6 +1162,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
||||
override val attachmentTrustCalculator: AttachmentTrustCalculator get() = this@AbstractNode.attachmentTrustCalculator
|
||||
override val diagnosticsService: DiagnosticsService get() = this@AbstractNode.diagnosticsService
|
||||
override val externalOperationExecutor: ExecutorService get() = this@AbstractNode.externalOperationExecutor
|
||||
override val notaryService: NotaryService? get() = this@AbstractNode.notaryService
|
||||
|
||||
private lateinit var _myInfo: NodeInfo
|
||||
override val myInfo: NodeInfo get() = _myInfo
|
||||
|
@ -9,6 +9,7 @@ import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.flows.FlowException
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.internal.*
|
||||
import net.corda.core.internal.notary.NotaryService
|
||||
import net.corda.core.node.ServiceHub
|
||||
import net.corda.core.node.ServicesForResolution
|
||||
import net.corda.core.node.services.AttachmentId
|
||||
@ -127,6 +128,8 @@ data class TestTransactionDSLInterpreter private constructor(
|
||||
|
||||
override val cordappProvider: CordappProvider =
|
||||
ledgerInterpreter.services.cordappProvider
|
||||
|
||||
override val notaryService: NotaryService? = null
|
||||
}
|
||||
|
||||
private fun copy(): TestTransactionDSLInterpreter =
|
||||
|
Loading…
Reference in New Issue
Block a user