diff --git a/core/src/main/kotlin/net/corda/core/flows/CollectSignaturesFlow.kt b/core/src/main/kotlin/net/corda/core/flows/CollectSignaturesFlow.kt index 6c21d55f22..e1da79c570 100644 --- a/core/src/main/kotlin/net/corda/core/flows/CollectSignaturesFlow.kt +++ b/core/src/main/kotlin/net/corda/core/flows/CollectSignaturesFlow.kt @@ -1,9 +1,7 @@ package net.corda.core.flows import co.paralleluniverse.fibers.Suspendable -import net.corda.core.conclave.common.dto.ConclaveLedgerTxModel import net.corda.core.conclave.common.dto.EncryptedVerifiableTxAndDependencies -import net.corda.core.conclave.common.dto.VerifiableTxAndDependencies import net.corda.core.crypto.TransactionSignature import net.corda.core.crypto.isFulfilledBy import net.corda.core.crypto.toStringShort @@ -264,7 +262,7 @@ class CollectSignatureFlow(val partiallySignedTx: SignedTransaction, val session * @param otherSideSession The session which is providing you a transaction to sign. */ abstract class SignTransactionFlow @JvmOverloads constructor(val otherSideSession: FlowSession, - override val progressTracker: ProgressTracker = SignTransactionFlow.tracker(), val encrypted : Boolean = false) : FlowLogic() { + override val progressTracker: ProgressTracker = SignTransactionFlow.tracker(), val encrypted: Boolean = false) : FlowLogic() { companion object { object RECEIVING : ProgressTracker.Step("Receiving transaction proposal for signing.") @@ -280,11 +278,11 @@ abstract class SignTransactionFlow @JvmOverloads constructor(val otherSideSessio progressTracker.currentStep = RECEIVING // Receive transaction and resolve dependencies, check sufficient signatures is disabled as we don't have all signatures. - var receivedEncryptedTx : EncryptedTransaction? = null + var usableLocallyEncryptedTransaction: EncryptedTransaction? = null val stx = if (encrypted) { val stxAndEncrypted = subFlow(ReceiveTransactionWithEncryptedFlow(otherSideSession, checkSufficientSignatures = false)) - receivedEncryptedTx = stxAndEncrypted.encryptedTransaction + usableLocallyEncryptedTransaction = stxAndEncrypted.encryptedTransaction stxAndEncrypted.signedTransaction } else { subFlow(ReceiveTransactionFlow(otherSideSession, checkSufficientSignatures = false, encrypted = true)) @@ -305,11 +303,7 @@ abstract class SignTransactionFlow @JvmOverloads constructor(val otherSideSessio if (encrypted) { val encryptionService = serviceHub.encryptedTransactionService val validatedTxSvc = serviceHub.validatedTransactions - - val usableReceivedTx = receivedEncryptedTx ?: throw IllegalStateException("An encrypted transaction is required") - - val locallyEncryptedTransaction = encryptionService.encryptTransactionForLocal(usableReceivedTx) - + val locallyEncryptedTransaction = usableLocallyEncryptedTransaction ?: throw IllegalStateException("An encrypted transaction is required") val encryptedTxs = stx.dependencies.mapNotNull { validatedTxSvc.getEncryptedTransaction(it) }.toSet() @@ -319,11 +313,11 @@ abstract class SignTransactionFlow @JvmOverloads constructor(val otherSideSessio }.toSet() encryptionService.enclaveVerifyWithoutSignatures( - EncryptedVerifiableTxAndDependencies( - locallyEncryptedTransaction, - signedTxs, - encryptedTxs - ) + EncryptedVerifiableTxAndDependencies( + locallyEncryptedTransaction, + signedTxs, + encryptedTxs + ) ) } else { stx.tx.toLedgerTransaction(serviceHub).verify() diff --git a/core/src/main/kotlin/net/corda/core/flows/ReceiveTransactionFlow.kt b/core/src/main/kotlin/net/corda/core/flows/ReceiveTransactionFlow.kt index 9bc981b234..def1ebe9b6 100644 --- a/core/src/main/kotlin/net/corda/core/flows/ReceiveTransactionFlow.kt +++ b/core/src/main/kotlin/net/corda/core/flows/ReceiveTransactionFlow.kt @@ -96,7 +96,7 @@ abstract class ReceiveTransactionFlowBase @JvmOverloads constructor(private v checkParameterHash(it.networkParametersHash) if (encryptedTx != null) { - require(encryptedTx.id == it.id) { + require(encryptedTx!!.id == it.id) { "The supplied signed transaction and encrypted transactions are different" } } @@ -112,7 +112,7 @@ abstract class ReceiveTransactionFlowBase @JvmOverloads constructor(private v val usableEncryptedTransaction = encryptedTxSvc.encryptTransactionForLocal( encryptedTx ?: throw IllegalStateException("And encrypted transaction is required") ) - + encryptedTx = usableEncryptedTransaction val signedTxs = it.dependencies.mapNotNull { validatedTxId -> validatedTxSvc.getTransaction(validatedTxId)