mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Add check in transaction builder
This commit is contained in:
parent
e8c20fc338
commit
ca3128f44c
@ -285,7 +285,9 @@ open class TransactionBuilder(
|
||||
// For each contract, resolve the AutomaticPlaceholderConstraint, and select the attachment.
|
||||
val contractAttachmentsAndResolvedOutputStates: List<Pair<AttachmentId, List<TransactionState<ContractState>>?>> = allContracts.toSet()
|
||||
.map { ctr ->
|
||||
handleContract(ctr, inputContractGroups[ctr], outputContractGroups[ctr], explicitAttachmentContractsMap[ctr], services)
|
||||
handleContract(ctr, inputContractGroups[ctr], outputContractGroups[ctr], explicitAttachmentContractsMap[ctr], services).also {
|
||||
it.second?.forEach { state -> checkForUnsupportedConstraints(state, services) }
|
||||
}
|
||||
}
|
||||
|
||||
val resolvedStates: List<TransactionState<ContractState>> = contractAttachmentsAndResolvedOutputStates.mapNotNull { it.second }
|
||||
@ -433,6 +435,15 @@ open class TransactionBuilder(
|
||||
return Pair(selectedAttachmentId, resolvedOutputStates)
|
||||
}
|
||||
|
||||
private fun checkForUnsupportedConstraints(transactionState: TransactionState<ContractState>, services: ServicesForResolution) {
|
||||
if (transactionState.constraint is SignatureAttachmentConstraint) {
|
||||
val constraintKey = transactionState.constraint.key
|
||||
if (constraintKey is CompositeKey && constraintKey.leafKeys.size > 1)
|
||||
checkMinimumPlatformVersion(services.networkParameters.minimumPlatformVersion, 5,
|
||||
"Composite keys for signature constraints")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the current transaction can migrate from a [HashAttachmentConstraint] to a
|
||||
* [SignatureAttachmentConstraint]. This is only possible in very specific scenarios. Most
|
||||
|
Loading…
Reference in New Issue
Block a user