ENT-11004 Store Ledger Recovery records only if the transaction was locally stored in the first place. (#7544)

This commit is contained in:
Jose Coll 2023-10-24 17:02:17 +01:00 committed by GitHub
parent be433c1fd0
commit be515abd08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,7 @@ open class SendTransactionFlow(val stx: SignedTransaction,
val DUMMY_PARTICIPANT_NAME = CordaX500Name("Transaction Participant", "London", "GB")
fun makeMetaData(stx: SignedTransaction, recordMetaDataEvenIfNotFullySigned: Boolean, senderStatesToRecord: StatesToRecord, participantSessions: Set<FlowSession>, observerSessions: Set<FlowSession>): TransactionMetadata? {
return if (recordMetaDataEvenIfNotFullySigned || isFullySigned(stx))
return if (recordMetaDataEvenIfNotFullySigned || isFullySignedAndStoredLocally(stx))
TransactionMetadata(DUMMY_PARTICIPANT_NAME,
SenderDistributionList(senderStatesToRecord,
(participantSessions.map { it.counterparty.name to StatesToRecord.ONLY_RELEVANT }).toMap() +
@ -104,6 +104,9 @@ open class SendTransactionFlow(val stx: SignedTransaction,
stx.resolveTransactionWithSignatures(serviceHub).getMissingSigners().isEmpty()
else false
}
private fun isFullySignedAndStoredLocally(stx: SignedTransaction) = isFullySigned(stx)
&& (currentTopLevel?.serviceHub?.validatedTransactions?.getTransaction(stx.id) != null)
}
}