mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
AttachmentDemo: Make sure the demo transaction is valid under new constraints
This commit is contained in:
parent
210cb4658a
commit
d1825261f7
@ -6,6 +6,7 @@ import net.corda.client.rpc.CordaRPCClient
|
|||||||
import net.corda.core.concurrent.CordaFuture
|
import net.corda.core.concurrent.CordaFuture
|
||||||
import net.corda.core.contracts.Contract
|
import net.corda.core.contracts.Contract
|
||||||
import net.corda.core.contracts.ContractState
|
import net.corda.core.contracts.ContractState
|
||||||
|
import net.corda.core.contracts.TypeOnlyCommandData
|
||||||
import net.corda.core.crypto.SecureHash
|
import net.corda.core.crypto.SecureHash
|
||||||
import net.corda.core.flows.FinalityFlow
|
import net.corda.core.flows.FinalityFlow
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
@ -115,8 +116,9 @@ class AttachmentDemoFlow(val otherSide: Party, val notary: Party, val hash: Secu
|
|||||||
override fun call(): SignedTransaction {
|
override fun call(): SignedTransaction {
|
||||||
// Create a trivial transaction with an output that describes the attachment, and the attachment itself
|
// Create a trivial transaction with an output that describes the attachment, and the attachment itself
|
||||||
val ptx = TransactionBuilder(notary)
|
val ptx = TransactionBuilder(notary)
|
||||||
ptx.addOutputState(AttachmentContract.State(hash))
|
.addOutputState(AttachmentContract.State(hash))
|
||||||
ptx.addAttachment(hash)
|
.addCommand(AttachmentContract.Command, serviceHub.legalIdentityKey)
|
||||||
|
.addAttachment(hash)
|
||||||
|
|
||||||
progressTracker.currentStep = SIGNING
|
progressTracker.currentStep = SIGNING
|
||||||
|
|
||||||
@ -183,6 +185,8 @@ class AttachmentContract : Contract {
|
|||||||
require(state.hash == attachment.id)
|
require(state.hash == attachment.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object Command : TypeOnlyCommandData()
|
||||||
|
|
||||||
data class State(val hash: SecureHash.SHA256) : ContractState {
|
data class State(val hash: SecureHash.SHA256) : ContractState {
|
||||||
override val contract: Contract = AttachmentContract()
|
override val contract: Contract = AttachmentContract()
|
||||||
override val participants: List<AbstractParty> = emptyList()
|
override val participants: List<AbstractParty> = emptyList()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user