Merge pull request #7524 from corda/merge-release/os/4.11-release/os/4.12-2023-10-05-12

ENT-10110: Merging forward updates from release/os/4.11 to release/os/4.12 - 2023-10-05
This commit is contained in:
Rick Parker 2023-10-06 14:42:57 +01:00 committed by GitHub
commit 341ce9fe74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 9 deletions

View File

@ -15,7 +15,7 @@ import net.corda.core.utilities.ProgressTracker
@InitiatingFlow
class LedgerRecoveryFlow(
private val parameters: LedgerRecoveryParameters,
override val progressTracker: ProgressTracker = ProgressTracker()) : FlowLogic<Long>() {
override val progressTracker: ProgressTracker = ProgressTracker()) : FlowLogic<LedgerRecoveryResult>() {
@CordaInternal
data class ExtraConstructorArgs(val parameters: LedgerRecoveryParameters)
@ -24,7 +24,7 @@ class LedgerRecoveryFlow(
@Suspendable
@Throws(LedgerRecoveryException::class)
override fun call(): Long {
override fun call(): LedgerRecoveryResult {
throw NotImplementedError("Enterprise only feature")
}
}
@ -40,6 +40,7 @@ class ReceiveLedgerRecoveryFlow constructor(private val otherSideSession: FlowSe
@CordaSerializable
class LedgerRecoveryException(message: String) : FlowException("Ledger recovery failed: $message")
@CordaSerializable
data class LedgerRecoveryParameters(
val recoveryPeers: Collection<Party>,
val timeWindow: RecoveryTimeWindow? = null,
@ -47,11 +48,18 @@ data class LedgerRecoveryParameters(
val transactionRole: TransactionRole = TransactionRole.ALL,
val dryRun: Boolean = false,
val optimisticInitiatorRecovery: Boolean = false,
val useTimeWindowNarrowing: Boolean = false,
val useTimeWindowNarrowing: Boolean = true,
val verboseLogging: Boolean = true,
val recoveryBatchSize: Int = 1000
)
@CordaSerializable
data class LedgerRecoveryResult(
val totalRecoveredRecords: Long,
val totalRecoveredTransactions: Long,
val totalErrors: Long
)
/**
* This specifies which type of transactions to recover based on the transaction role of the recovering node
*/

View File

@ -132,7 +132,7 @@ open class DataVendingFlow(val otherSessions: Set<FlowSession>, val payload: Any
protected open fun isFinality(): Boolean = false
@Suppress("ComplexCondition", "ComplexMethod", "LongMethod")
@Suppress("ComplexCondition", "ComplexMethod", "LongMethod", "TooGenericExceptionThrown")
@Suspendable
override fun call(): Void? {
val networkMaxMessageSize = serviceHub.networkParameters.maxMessageSize
@ -151,11 +151,14 @@ open class DataVendingFlow(val otherSessions: Set<FlowSession>, val payload: Any
is NotarisationPayload -> TransactionAuthorisationFilter().addAuthorised(getInputTransactions(payload.signedTransaction))
is SignedTransaction -> TransactionAuthorisationFilter().addAuthorised(getInputTransactions(payload))
is RetrieveAnyTransactionPayload -> TransactionAuthorisationFilter(acceptAll = true)
is List<*> -> TransactionAuthorisationFilter().addAuthorised(payload.flatMap { stateAndRef ->
if (stateAndRef is StateAndRef<*>) {
getInputTransactions(serviceHub.validatedTransactions.getTransaction(stateAndRef.ref.txhash)!!) + stateAndRef.ref.txhash
is List<*> -> TransactionAuthorisationFilter().addAuthorised(payload.flatMap { someObject ->
if (someObject is StateAndRef<*>) {
getInputTransactions(serviceHub.validatedTransactions.getTransaction(someObject.ref.txhash)!!) + someObject.ref.txhash
}
else if (someObject is NamedByHash) {
setOf(someObject.id)
} else {
throw Exception("Unknown payload type: ${stateAndRef!!::class.java} ?")
throw Exception("Unknown payload type: ${someObject!!::class.java} ?")
}
}.toSet())
else -> throw Exception("Unknown payload type: ${payload::class.java} ?")

View File

@ -26,6 +26,9 @@ class ResolveTransactionsFlow private constructor(
constructor(txHashes: Set<SecureHash>, otherSide: FlowSession, statesToRecord: StatesToRecord = StatesToRecord.NONE)
: this(null, txHashes, otherSide, statesToRecord)
constructor(txHashes: Set<SecureHash>, otherSide: FlowSession, statesToRecord: StatesToRecord, deferredAck: Boolean)
: this(null, txHashes, otherSide, statesToRecord, deferredAck)
/**
* Resolves and validates the dependencies of the specified [SignedTransaction]. Fetches the attachments, but does
* *not* validate or store the [SignedTransaction] itself.

View File

@ -78,7 +78,7 @@ class DBTransactionStorageLedgerRecovery(private val database: CordaPersistence,
@CordaSerializable
@Entity
@Table(name = "${NODE_DATABASE_PREFIX}receiver_distr_recs")
class DBReceiverDistributionRecord(
data class DBReceiverDistributionRecord(
@EmbeddedId
var compositeKey: PersistentKey,