mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
Fix notary demo. (#1577)
This commit is contained in:
parent
80b3411fa5
commit
b1d1d74d6e
@ -14,12 +14,15 @@ import net.corda.core.transactions.TransactionBuilder
|
||||
|
||||
@StartableByRPC
|
||||
class DummyIssueAndMove(private val notary: Party, private val counterpartyNode: Party, private val discriminator: Int) : FlowLogic<SignedTransaction>() {
|
||||
val DO_NOTHING_PROGRAM_ID = "net.corda.notarydemo.flows.DummyIssueAndMove.DoNothingContract"
|
||||
object DoNothingContract : Contract {
|
||||
companion object {
|
||||
private val DO_NOTHING_PROGRAM_ID = "net.corda.notarydemo.flows.DummyIssueAndMove\$DoNothingContract"
|
||||
}
|
||||
|
||||
class DoNothingContract : Contract {
|
||||
override fun verify(tx: LedgerTransaction) {}
|
||||
}
|
||||
|
||||
data class DummyCommand(val dummy: Int = 0): CommandData
|
||||
data class DummyCommand(val dummy: Int = 0) : CommandData
|
||||
|
||||
data class State(override val participants: List<AbstractParty>, private val discriminator: Int) : ContractState
|
||||
|
||||
@ -29,7 +32,7 @@ class DummyIssueAndMove(private val notary: Party, private val counterpartyNode:
|
||||
val state = State(listOf(ourIdentity), discriminator)
|
||||
val issueTx = serviceHub.signInitialTransaction(TransactionBuilder(notary).apply {
|
||||
addOutputState(state, DO_NOTHING_PROGRAM_ID)
|
||||
addCommand(DummyCommand(),listOf(ourIdentity.owningKey))
|
||||
addCommand(DummyCommand(), listOf(ourIdentity.owningKey))
|
||||
})
|
||||
serviceHub.recordTransactions(issueTx)
|
||||
// Move ownership of the asset to the counterparty
|
||||
@ -37,7 +40,7 @@ class DummyIssueAndMove(private val notary: Party, private val counterpartyNode:
|
||||
return serviceHub.signInitialTransaction(TransactionBuilder(notary).apply {
|
||||
addInputState(issueTx.tx.outRef<ContractState>(0))
|
||||
addOutputState(state.copy(participants = listOf(counterpartyNode)), DO_NOTHING_PROGRAM_ID)
|
||||
addCommand(DummyCommand(),listOf(ourIdentity.owningKey))
|
||||
addCommand(DummyCommand(), listOf(ourIdentity.owningKey))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user