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 @InitiatingFlow
class LedgerRecoveryFlow( class LedgerRecoveryFlow(
private val parameters: LedgerRecoveryParameters, private val parameters: LedgerRecoveryParameters,
override val progressTracker: ProgressTracker = ProgressTracker()) : FlowLogic<Long>() { override val progressTracker: ProgressTracker = ProgressTracker()) : FlowLogic<LedgerRecoveryResult>() {
@CordaInternal @CordaInternal
data class ExtraConstructorArgs(val parameters: LedgerRecoveryParameters) data class ExtraConstructorArgs(val parameters: LedgerRecoveryParameters)
@ -24,7 +24,7 @@ class LedgerRecoveryFlow(
@Suspendable @Suspendable
@Throws(LedgerRecoveryException::class) @Throws(LedgerRecoveryException::class)
override fun call(): Long { override fun call(): LedgerRecoveryResult {
throw NotImplementedError("Enterprise only feature") throw NotImplementedError("Enterprise only feature")
} }
} }
@ -40,6 +40,7 @@ class ReceiveLedgerRecoveryFlow constructor(private val otherSideSession: FlowSe
@CordaSerializable @CordaSerializable
class LedgerRecoveryException(message: String) : FlowException("Ledger recovery failed: $message") class LedgerRecoveryException(message: String) : FlowException("Ledger recovery failed: $message")
@CordaSerializable
data class LedgerRecoveryParameters( data class LedgerRecoveryParameters(
val recoveryPeers: Collection<Party>, val recoveryPeers: Collection<Party>,
val timeWindow: RecoveryTimeWindow? = null, val timeWindow: RecoveryTimeWindow? = null,
@ -47,11 +48,18 @@ data class LedgerRecoveryParameters(
val transactionRole: TransactionRole = TransactionRole.ALL, val transactionRole: TransactionRole = TransactionRole.ALL,
val dryRun: Boolean = false, val dryRun: Boolean = false,
val optimisticInitiatorRecovery: Boolean = false, val optimisticInitiatorRecovery: Boolean = false,
val useTimeWindowNarrowing: Boolean = false, val useTimeWindowNarrowing: Boolean = true,
val verboseLogging: Boolean = true, val verboseLogging: Boolean = true,
val recoveryBatchSize: Int = 1000 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 * 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 protected open fun isFinality(): Boolean = false
@Suppress("ComplexCondition", "ComplexMethod", "LongMethod") @Suppress("ComplexCondition", "ComplexMethod", "LongMethod", "TooGenericExceptionThrown")
@Suspendable @Suspendable
override fun call(): Void? { override fun call(): Void? {
val networkMaxMessageSize = serviceHub.networkParameters.maxMessageSize 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 NotarisationPayload -> TransactionAuthorisationFilter().addAuthorised(getInputTransactions(payload.signedTransaction))
is SignedTransaction -> TransactionAuthorisationFilter().addAuthorised(getInputTransactions(payload)) is SignedTransaction -> TransactionAuthorisationFilter().addAuthorised(getInputTransactions(payload))
is RetrieveAnyTransactionPayload -> TransactionAuthorisationFilter(acceptAll = true) is RetrieveAnyTransactionPayload -> TransactionAuthorisationFilter(acceptAll = true)
is List<*> -> TransactionAuthorisationFilter().addAuthorised(payload.flatMap { stateAndRef -> is List<*> -> TransactionAuthorisationFilter().addAuthorised(payload.flatMap { someObject ->
if (stateAndRef is StateAndRef<*>) { if (someObject is StateAndRef<*>) {
getInputTransactions(serviceHub.validatedTransactions.getTransaction(stateAndRef.ref.txhash)!!) + stateAndRef.ref.txhash getInputTransactions(serviceHub.validatedTransactions.getTransaction(someObject.ref.txhash)!!) + someObject.ref.txhash
}
else if (someObject is NamedByHash) {
setOf(someObject.id)
} else { } else {
throw Exception("Unknown payload type: ${stateAndRef!!::class.java} ?") throw Exception("Unknown payload type: ${someObject!!::class.java} ?")
} }
}.toSet()) }.toSet())
else -> throw Exception("Unknown payload type: ${payload::class.java} ?") 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) constructor(txHashes: Set<SecureHash>, otherSide: FlowSession, statesToRecord: StatesToRecord = StatesToRecord.NONE)
: this(null, txHashes, otherSide, statesToRecord) : 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 * Resolves and validates the dependencies of the specified [SignedTransaction]. Fetches the attachments, but does
* *not* validate or store the [SignedTransaction] itself. * *not* validate or store the [SignedTransaction] itself.

View File

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