mirror of
https://github.com/corda/corda.git
synced 2024-12-21 05:53:23 +00:00
Remove whitelist constraint warnings. (#4488)
This commit is contained in:
parent
4ac701e648
commit
97e02cd9ca
@ -39,28 +39,12 @@ open class CordappProviderImpl(val cordappLoader: CordappLoader,
|
|||||||
|
|
||||||
fun start(whitelistedContractImplementations: Map<String, List<AttachmentId>>) {
|
fun start(whitelistedContractImplementations: Map<String, List<AttachmentId>>) {
|
||||||
cordappAttachments.putAll(loadContractsIntoAttachmentStore())
|
cordappAttachments.putAll(loadContractsIntoAttachmentStore())
|
||||||
verifyInstalledCordapps(whitelistedContractImplementations)
|
verifyInstalledCordapps()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun verifyInstalledCordapps(whitelistedContractImplementations: Map<String, List<AttachmentId>>) {
|
private fun verifyInstalledCordapps() {
|
||||||
// This will invoke the lazy flowCordappMap property, thus triggering the MultipleCordappsForFlow check.
|
// This will invoke the lazy flowCordappMap property, thus triggering the MultipleCordappsForFlow check.
|
||||||
cordappLoader.flowCordappMap
|
cordappLoader.flowCordappMap
|
||||||
|
|
||||||
if (whitelistedContractImplementations.isEmpty()) {
|
|
||||||
log.warn("The network parameters don't specify any whitelisted contract implementations. Please contact your zone operator. See https://docs.corda.net/network-map.html")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that the installed contract classes correspond with the whitelist hash
|
|
||||||
// And warn if node is not using latest CorDapp
|
|
||||||
cordappAttachments.keys.map(attachmentStorage::openAttachment).mapNotNull { it as? ContractAttachment }.forEach { attch ->
|
|
||||||
(attch.allContracts intersect whitelistedContractImplementations.keys).forEach { contractClassName ->
|
|
||||||
when {
|
|
||||||
attch.id !in whitelistedContractImplementations[contractClassName]!! -> log.error("Contract $contractClassName found in attachment ${attch.id} is not whitelisted in the network parameters. If this is a production node contact your zone operator. See https://docs.corda.net/network-map.html")
|
|
||||||
attch.id != whitelistedContractImplementations[contractClassName]!!.last() -> log.warn("You are not using the latest CorDapp version for contract: $contractClassName. Please contact your zone operator.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAppContext(): CordappContext {
|
override fun getAppContext(): CordappContext {
|
||||||
|
Loading…
Reference in New Issue
Block a user