diff --git a/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt index bba066f2be..33d33d4740 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt @@ -3,14 +3,14 @@ package net.corda.node.services import com.nhaarman.mockito_kotlin.whenever import net.corda.core.contracts.ContractState import net.corda.core.contracts.StateRef -import net.corda.core.crypto.SecureHash import net.corda.core.crypto.composite.CompositeKey -import net.corda.core.internal.div import net.corda.core.flows.NotaryError import net.corda.core.flows.NotaryException import net.corda.core.flows.NotaryFlow import net.corda.core.identity.Party +import net.corda.core.internal.div import net.corda.core.node.services.ServiceInfo +import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.TransactionBuilder import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.Try @@ -23,6 +23,7 @@ import net.corda.node.services.transactions.minClusterSize import net.corda.node.services.transactions.minCorrectReplicas import net.corda.node.utilities.ServiceIdentityGenerator import net.corda.testing.contracts.DummyContract +import net.corda.testing.dummyCommand import net.corda.testing.node.MockNetwork import org.bouncycastle.asn1.x500.X500Name import org.junit.After @@ -70,7 +71,9 @@ class BFTNotaryServiceTests { fun `all replicas start even if there is a new consensus during startup`() { val notary = bftNotaryCluster(minClusterSize(1), true) // This true adds a sleep to expose the race. val f = node.run { - val trivialTx = signInitialTransaction(notary) {} + val trivialTx = signInitialTransaction(notary) { + addOutputState(DummyContract.SingleOwnerState(owner = info.legalIdentity)) + } // Create a new consensus while the redundant replica is sleeping: services.startFlow(NotaryFlow.Client(trivialTx)).resultFuture } @@ -99,7 +102,7 @@ class BFTNotaryServiceTests { services.recordTransactions(issueTx) } val spendTxs = (1..10).map { - signInitialTransaction(notary, true) { + signInitialTransaction(notary) { addInputState(issueTx.tx.outRef(0)) } } @@ -137,11 +140,11 @@ class BFTNotaryServiceTests { private fun AbstractNode.signInitialTransaction( notary: Party, - makeUnique: Boolean = false, block: TransactionBuilder.() -> Any? -) = services.signInitialTransaction(TransactionBuilder(notary).apply { - block() - if (makeUnique) { - addAttachment(SecureHash.randomSHA256()) - } -}) +): SignedTransaction { + return services.signInitialTransaction( + TransactionBuilder(notary).apply { + addCommand(dummyCommand(services.legalIdentityKey)) + block() + }) +} diff --git a/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt index b999da66d2..a91edb17aa 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt @@ -2,17 +2,18 @@ package net.corda.node.services import net.corda.core.contracts.StateAndRef import net.corda.core.contracts.StateRef -import net.corda.testing.contracts.DummyContract -import net.corda.core.identity.Party -import net.corda.testing.DUMMY_BANK_A import net.corda.core.flows.NotaryError import net.corda.core.flows.NotaryException import net.corda.core.flows.NotaryFlow +import net.corda.core.identity.Party import net.corda.core.internal.concurrent.map import net.corda.core.internal.concurrent.transpose -import net.corda.core.utilities.getOrThrow import net.corda.core.transactions.TransactionBuilder +import net.corda.core.utilities.getOrThrow import net.corda.node.internal.AbstractNode +import net.corda.testing.DUMMY_BANK_A +import net.corda.testing.contracts.DummyContract +import net.corda.testing.dummyCommand import net.corda.testing.node.NodeBasedTest import org.bouncycastle.asn1.x500.X500Name import org.junit.Test @@ -34,7 +35,9 @@ class RaftNotaryServiceTests : NodeBasedTest() { val inputState = issueState(bankA, notaryParty) - val firstTxBuilder = TransactionBuilder(notaryParty).withItems(inputState) + val firstTxBuilder = TransactionBuilder(notaryParty) + .addInputState(inputState) + .addCommand(dummyCommand(bankA.services.legalIdentityKey)) val firstSpendTx = bankA.services.signInitialTransaction(firstTxBuilder) val firstSpend = bankA.services.startFlow(NotaryFlow.Client(firstSpendTx)) @@ -43,6 +46,7 @@ class RaftNotaryServiceTests : NodeBasedTest() { val secondSpendBuilder = TransactionBuilder(notaryParty).withItems(inputState).run { val dummyState = DummyContract.SingleOwnerState(0, bankA.info.legalIdentity) addOutputState(dummyState) + addCommand(dummyCommand(bankA.services.legalIdentityKey)) this } val secondSpendTx = bankA.services.signInitialTransaction(secondSpendBuilder) diff --git a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt index caf80073d6..cf0e136b88 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/statemachine/LargeTransactionsTest.kt @@ -1,19 +1,18 @@ package net.corda.node.services.statemachine import co.paralleluniverse.fibers.Suspendable -import net.corda.core.internal.InputStreamAndHash import net.corda.core.crypto.SecureHash import net.corda.core.flows.* import net.corda.core.identity.Party +import net.corda.core.internal.InputStreamAndHash import net.corda.core.messaging.startFlow -import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.TransactionBuilder -import net.corda.core.utilities.unwrap import net.corda.testing.BOB import net.corda.testing.DUMMY_NOTARY import net.corda.testing.aliceBobAndNotary import net.corda.testing.contracts.DummyState import net.corda.testing.driver.driver +import net.corda.testing.dummyCommand import org.junit.Test import kotlin.test.assertEquals @@ -28,6 +27,7 @@ class LargeTransactionsTest { override fun call() { val tx = TransactionBuilder(notary = DUMMY_NOTARY) .addOutputState(DummyState()) + .addCommand(dummyCommand(serviceHub.legalIdentityKey)) .addAttachment(hash1) .addAttachment(hash2) .addAttachment(hash3)