ENT-2682 Fix cordapp layout for notaryhealthcheck (#1528)

* Move state and command to contract.

* Rollback compiler.xml
This commit is contained in:
Christian Sailer 2018-11-02 15:39:14 +00:00 committed by GitHub
parent 6fb2996fd6
commit 07719489e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,9 @@
package net.corda.notaryhealthcheck.contract
import net.corda.core.contracts.CommandData
import net.corda.core.contracts.Contract
import net.corda.core.contracts.ContractState
import net.corda.core.identity.AbstractParty
import net.corda.core.transactions.LedgerTransaction
/**
@ -8,4 +11,6 @@ import net.corda.core.transactions.LedgerTransaction
*/
class NullContract : Contract {
override fun verify(tx: LedgerTransaction) {}
data class NullCommand(val data: Byte = 0) : CommandData // Param must be public for AMQP serialization.
data class State(override val participants: List<AbstractParty>) : ContractState
}

View File

@ -4,7 +4,8 @@ import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.*
import net.corda.core.crypto.TransactionSignature
import net.corda.core.flows.*
import net.corda.core.identity.AbstractParty
import net.corda.core.flows.NotaryFlow.Client.Companion.REQUESTING
import net.corda.core.flows.NotaryFlow.Client.Companion.VALIDATING
import net.corda.core.identity.Party
import net.corda.core.internal.FetchDataFlow
import net.corda.core.internal.notary.generateSignature
@ -23,11 +24,6 @@ class HealthCheckFlow(monitorable: Monitorable) : FlowLogic<List<TransactionSign
private val notary = monitorable.notary
private val party = monitorable.party
data class NullCommand(val data: Byte = 0) : CommandData // Param must be public for AMQP serialization.
@BelongsToContract(NullContract::class)
data class State(override val participants: List<AbstractParty>) : ContractState
companion object {
object PREPARING : ProgressTracker.Step("Preparing")
object CHECKING : ProgressTracker.Step("Checking")
@ -39,8 +35,8 @@ class HealthCheckFlow(monitorable: Monitorable) : FlowLogic<List<TransactionSign
override fun call(): List<TransactionSignature> {
progressTracker.currentStep = PREPARING
val stx = serviceHub.signInitialTransaction(TransactionBuilder(notary).apply {
addOutputState(State(listOf(ourIdentity)), NullContract::class.java.name, AlwaysAcceptAttachmentConstraint)
addCommand(NullCommand(), listOf(ourIdentity.owningKey))
addOutputState(NullContract.State(listOf(ourIdentity)), NullContract::class.java.name, AlwaysAcceptAttachmentConstraint)
addCommand(NullContract.NullCommand(), listOf(ourIdentity.owningKey))
})
progressTracker.currentStep = CHECKING
return subFlow(NotaryClientFlow(stx, party, notary))