[在Corda中,我们如何设计合同以防止某个节点创建特定类型的状态?ⁿ例如,不应允许节点Student创建一个QuestionPaper状态。
您可以在示例存储库中遵循blacklist项目的方法:https://github.com/corda/samples/tree/release-V4/blacklist
QuestionPaper
状态的流程必须在事务中添加附件:https://github.com/corda/samples/blob/018502310b56bc1bb31440380af4b89e9bbd7ed8/blacklist/src/main/kotlin/net/corda/examples/attachments/flow/ReachAgreementFlow.kt#L31Student
节点的文件):https://github.com/corda/samples/blob/018502310b56bc1bb31440380af4b89e9bbd7ed8/blacklist/src/main/kotlin/net/corda/examples/attachments/contract/AgreementContract.kt#L33issuer
(QuestionPaper
中的属性)是否不在黑名单中(即Student
节点):https://github.com/corda/samples/blob/018502310b56bc1bb31440380af4b89e9bbd7ed8/blacklist/src/main/kotlin/net/corda/examples/attachments/contract/AgreementContract.kt#L53