Merge pull request #7874 from corda/adel/ENT-12402

ENT-12402: In external verifier pass the rotated keys to attachment c…
This commit is contained in:
Adel El-Beik 2024-11-07 17:50:22 +00:00 committed by GitHub
commit 844b33ee94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,19 +56,18 @@ class ExternalVerifier(private val channel: SocketChannel) {
private val log = contextLogger() private val log = contextLogger()
} }
private val attachmentsClassLoaderCache: AttachmentsClassLoaderCache
private val attachmentFixups = AttachmentFixups() private val attachmentFixups = AttachmentFixups()
private val parties: OptionalCache<PublicKey, Party> private val parties: OptionalCache<PublicKey, Party>
private val attachments: OptionalCache<SecureHash, AttachmentWithTrust> private val attachments: OptionalCache<SecureHash, AttachmentWithTrust>
private val networkParametersMap: OptionalCache<SecureHash, NetworkParameters> private val networkParametersMap: OptionalCache<SecureHash, NetworkParameters>
private val trustedClassAttachments: Cache<String, List<SecureHash>> private val trustedClassAttachments: Cache<String, List<SecureHash>>
private val cacheFactory = ExternalVerifierNamedCacheFactory()
private lateinit var attachmentsClassLoaderCache: AttachmentsClassLoaderCache
private lateinit var currentNetworkParameters: NetworkParameters private lateinit var currentNetworkParameters: NetworkParameters
private lateinit var rotatedKeys: RotatedKeys private lateinit var rotatedKeys: RotatedKeys
init { init {
val cacheFactory = ExternalVerifierNamedCacheFactory()
attachmentsClassLoaderCache = AttachmentsClassLoaderCacheImpl(cacheFactory)
parties = cacheFactory.buildNamed("ExternalVerifier_parties") parties = cacheFactory.buildNamed("ExternalVerifier_parties")
attachments = cacheFactory.buildNamed("ExternalVerifier_attachments") attachments = cacheFactory.buildNamed("ExternalVerifier_attachments")
networkParametersMap = cacheFactory.buildNamed("ExternalVerifier_networkParameters") networkParametersMap = cacheFactory.buildNamed("ExternalVerifier_networkParameters")
@ -98,6 +97,7 @@ class ExternalVerifier(private val channel: SocketChannel) {
currentNetworkParameters = initialisation.currentNetworkParameters currentNetworkParameters = initialisation.currentNetworkParameters
networkParametersMap.put(initialisation.serializedCurrentNetworkParameters.hash, Optional.of(currentNetworkParameters)) networkParametersMap.put(initialisation.serializedCurrentNetworkParameters.hash, Optional.of(currentNetworkParameters))
rotatedKeys = initialisation.rotatedKeys rotatedKeys = initialisation.rotatedKeys
attachmentsClassLoaderCache = AttachmentsClassLoaderCacheImpl(cacheFactory, rotatedKeys)
log.info("External verifier initialised") log.info("External verifier initialised")
} }