From 5d84d0a5c9f08dda8b4249a9dfd44f9c744331aa Mon Sep 17 00:00:00 2001 From: Rick Parker Date: Wed, 6 Sep 2023 16:32:47 +0100 Subject: [PATCH] ENT-10306 Missed actually verifying transaction from recent refactor (#7483) --- .../corda/core/flows/ReceiveTransactionFlow.kt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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 7b45d972af..31bbc4cf3b 100644 --- a/core/src/main/kotlin/net/corda/core/flows/ReceiveTransactionFlow.kt +++ b/core/src/main/kotlin/net/corda/core/flows/ReceiveTransactionFlow.kt @@ -78,12 +78,7 @@ open class ReceiveTransactionFlow constructor(private val otherSideSession: Flow checkParameterHash(stx.networkParametersHash) subFlow(ResolveTransactionsFlow(stx, otherSideSession, statesToRecord, deferredAck)) logger.info("Transaction dependencies resolution completed.") - try { - stx.verify(serviceHub, checkSufficientSignatures) - } catch (e: Exception) { - logger.warn("Transaction verification failed.") - throw e - } + verifyTx(stx, checkSufficientSignatures) if (checkSufficientSignatures) { // We should only send a transaction to the vault for processing if we did in fact fully verify it, and // there are no missing signatures. We don't want partly signed stuff in the vault. @@ -97,6 +92,15 @@ open class ReceiveTransactionFlow constructor(private val otherSideSession: Flow } } + private fun verifyTx(stx: SignedTransaction, localCheckSufficientSignatures: Boolean) { + try { + stx.verify(serviceHub, localCheckSufficientSignatures) + } catch (e: Exception) { + logger.warn("Transaction verification failed.") + throw e + } + } + private fun isDeferredAck(payload: Any): Boolean { return payload is SignedTransactionWithDistributionList && checkSufficientSignatures && payload.isFinality } @@ -109,7 +113,7 @@ open class ReceiveTransactionFlow constructor(private val otherSideSession: Flow checkParameterHash(stx.networkParametersHash) subFlow(ResolveTransactionsFlow(stx, otherSideSession, statesToRecord, true)) logger.info("Transaction dependencies resolution completed.") - + verifyTx(stx, false) serviceHub.telemetryServiceInternal.span("${this::class.java.name}#recordUnnotarisedTransaction", flowLogic = this) { logger.debug { "Peer recording transaction without notary signature." } (serviceHub as ServiceHubCoreInternal).recordUnnotarisedTransaction(stx)