mirror of
https://github.com/corda/corda.git
synced 2025-02-06 11:09:18 +00:00
Add minimum platform version check before attempting a hash -> signature constraints auto migration. (#4623)
This commit is contained in:
parent
100a6fcb56
commit
82f5a756fe
@ -280,10 +280,11 @@ open class TransactionBuilder(
|
||||
): Pair<Set<AttachmentId>, List<TransactionState<ContractState>>?> {
|
||||
val inputsAndOutputs = (inputStates ?: emptyList()) + (outputStates ?: emptyList())
|
||||
|
||||
// Hash to Signature constraints migration switchover
|
||||
// Hash to Signature constraints migration switchover (only applicable from version 4 onwards)
|
||||
// identify if any input-output pairs are transitioning from hash to signature constraints:
|
||||
// 1. output states contain implicitly selected hash constraint (pre-existing from set of unconsumed states in a nodes vault) or explicitly set SignatureConstraint
|
||||
// 2. node has signed jar for associated contract class and version
|
||||
if (services.networkParameters.minimumPlatformVersion >= 4) {
|
||||
val inputsHashConstraints = inputStates?.filter { it.constraint is HashAttachmentConstraint } ?: emptyList()
|
||||
val outputHashConstraints = outputStates?.filter { it.constraint is HashAttachmentConstraint } ?: emptyList()
|
||||
val outputSignatureConstraints = outputStates?.filter { it.constraint is SignatureAttachmentConstraint } ?: emptyList()
|
||||
@ -308,6 +309,7 @@ open class TransactionBuilder(
|
||||
return Pair(attachmentIds.toSet(), outputConstraints)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if there are any HashConstraints that pin the version of a contract. If there are, check if we trust them.
|
||||
val hashAttachments = inputsAndOutputs
|
||||
|
Loading…
x
Reference in New Issue
Block a user