corda / net.corda.core.contracts / AttachmentConstraint


@DoNotImplement interface AttachmentConstraint

Constrain which contract-code-containing attachment can be used with a ContractState.



abstract fun isSatisfiedBy(attachment: Attachment): Boolean

Returns whether the given contract attachment can be used with the ContractState associated with this constraint object.

Extension Functions


fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.



object AlwaysAcceptAttachmentConstraint : AttachmentConstraint

An AttachmentConstraint where isSatisfiedBy always returns true.


object AutomaticHashConstraint : AttachmentConstraint

This AttachmentConstraint is a convenience class that will be automatically resolved to a HashAttachmentConstraint. The resolution occurs in TransactionBuilder.toWireTransaction and uses the TransactionState.contract value to find a corresponding loaded Cordapp that contains such a contract, and then uses that Cordapp as the Attachment.


data class HashAttachmentConstraint : AttachmentConstraint

An AttachmentConstraint that verifies by hash. The state protected by this constraint can only be used in a transaction created with that version of the jar. And a receiving node will only accept it if a cordapp with that hash has (is) been deployed on the node.


object WhitelistedByZoneAttachmentConstraint : AttachmentConstraint

An AttachmentConstraint that verifies that the hash of the attachment is in the network parameters whitelist. See: net.corda.core.node.NetworkParameters.whitelistedContractImplementations It allows for centralized control over the cordapps that can be used.