ENT-10009 Enhance SendTransactionFlow to allow sending a txn to multiple sessions. (#7393)

This commit is contained in:
Jose Coll 2023-06-09 17:19:43 +01:00 committed by GitHub
parent 41e9298b19
commit 0e877958fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 362 additions and 177 deletions

View File

@ -1798,6 +1798,8 @@ public final class net.corda.core.crypto.Crypto extends java.lang.Object
public static final boolean doVerify(net.corda.core.crypto.SecureHash, net.corda.core.crypto.TransactionSignature) public static final boolean doVerify(net.corda.core.crypto.SecureHash, net.corda.core.crypto.TransactionSignature)
public static final boolean doVerify(net.corda.core.crypto.SignatureScheme, java.security.PublicKey, byte[], byte[]) public static final boolean doVerify(net.corda.core.crypto.SignatureScheme, java.security.PublicKey, byte[], byte[])
@NotNull @NotNull
public static final byte[] encodePublicKey(java.security.PublicKey)
@NotNull
public static final java.security.Provider findProvider(String) public static final java.security.Provider findProvider(String)
@NotNull @NotNull
public static final net.corda.core.crypto.SignatureScheme findSignatureScheme(int) public static final net.corda.core.crypto.SignatureScheme findSignatureScheme(int)
@ -2518,12 +2520,16 @@ public static final class net.corda.core.flows.ContractUpgradeFlow$Initiate exte
protected net.corda.core.flows.AbstractStateReplacementFlow$UpgradeTx assembleTx() protected net.corda.core.flows.AbstractStateReplacementFlow$UpgradeTx assembleTx()
## ##
public class net.corda.core.flows.DataVendingFlow extends net.corda.core.flows.FlowLogic public class net.corda.core.flows.DataVendingFlow extends net.corda.core.flows.FlowLogic
public <init>(java.util.Set<? extends net.corda.core.flows.FlowSession>, Object, net.corda.core.flows.TransactionMetadata)
public <init>(java.util.Set, Object, net.corda.core.flows.TransactionMetadata, int, kotlin.jvm.internal.DefaultConstructorMarker)
public <init>(net.corda.core.flows.FlowSession, Object) public <init>(net.corda.core.flows.FlowSession, Object)
public <init>(net.corda.core.flows.FlowSession, Object, net.corda.core.flows.TransactionMetadata)
public <init>(net.corda.core.flows.FlowSession, Object, net.corda.core.flows.TransactionMetadata, int, kotlin.jvm.internal.DefaultConstructorMarker)
@Suspendable @Suspendable
@Nullable @Nullable
public Void call() public Void call()
@NotNull @NotNull
public final net.corda.core.flows.FlowSession getOtherSideSession() public final java.util.Set<net.corda.core.flows.FlowSession> getOtherSessions()
@NotNull @NotNull
public final Object getPayload() public final Object getPayload()
@Suspendable @Suspendable
@ -2535,10 +2541,29 @@ public class net.corda.core.flows.DataVendingFlow extends net.corda.core.flows.F
@DoNotImplement @DoNotImplement
public interface net.corda.core.flows.Destination public interface net.corda.core.flows.Destination
## ##
@CordaSerializable
public final class net.corda.core.flows.DistributionList extends java.lang.Object
public <init>(net.corda.core.node.StatesToRecord, java.util.Map<net.corda.core.identity.CordaX500Name, ? extends net.corda.core.node.StatesToRecord>)
@NotNull
public final net.corda.core.node.StatesToRecord component1()
@NotNull
public final java.util.Map<net.corda.core.identity.CordaX500Name, net.corda.core.node.StatesToRecord> component2()
@NotNull
public final net.corda.core.flows.DistributionList copy(net.corda.core.node.StatesToRecord, java.util.Map<net.corda.core.identity.CordaX500Name, ? extends net.corda.core.node.StatesToRecord>)
public boolean equals(Object)
@NotNull
public final java.util.Map<net.corda.core.identity.CordaX500Name, net.corda.core.node.StatesToRecord> getPeersToStatesToRecord()
@NotNull
public final net.corda.core.node.StatesToRecord getSenderStatesToRecord()
public int hashCode()
@NotNull
public String toString()
##
@InitiatingFlow @InitiatingFlow
public final class net.corda.core.flows.FinalityFlow extends net.corda.core.flows.FlowLogic public final class net.corda.core.flows.FinalityFlow extends net.corda.core.flows.FlowLogic
public <init>(net.corda.core.transactions.SignedTransaction) public <init>(net.corda.core.transactions.SignedTransaction)
public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>) public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>)
public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>, java.util.Collection<? extends net.corda.core.flows.FlowSession>)
public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>, java.util.Collection<net.corda.core.identity.Party>, net.corda.core.utilities.ProgressTracker) public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>, java.util.Collection<net.corda.core.identity.Party>, net.corda.core.utilities.ProgressTracker)
public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>, net.corda.core.node.StatesToRecord) public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>, net.corda.core.node.StatesToRecord)
public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>, net.corda.core.node.StatesToRecord, net.corda.core.utilities.ProgressTracker) public <init>(net.corda.core.transactions.SignedTransaction, java.util.Collection<? extends net.corda.core.flows.FlowSession>, net.corda.core.node.StatesToRecord, net.corda.core.utilities.ProgressTracker)
@ -2570,12 +2595,32 @@ public static final class net.corda.core.flows.FinalityFlow$Companion$BROADCASTI
public static final net.corda.core.flows.FinalityFlow$Companion$BROADCASTING INSTANCE public static final net.corda.core.flows.FinalityFlow$Companion$BROADCASTING INSTANCE
## ##
@CordaSerializable @CordaSerializable
public static final class net.corda.core.flows.FinalityFlow$Companion$BROADCASTING_NOTARY_ERROR extends net.corda.core.utilities.ProgressTracker$Step
public static final net.corda.core.flows.FinalityFlow$Companion$BROADCASTING_NOTARY_ERROR INSTANCE
##
@CordaSerializable
public static final class net.corda.core.flows.FinalityFlow$Companion$BROADCASTING_POST_NOTARISATION extends net.corda.core.utilities.ProgressTracker$Step
public static final net.corda.core.flows.FinalityFlow$Companion$BROADCASTING_POST_NOTARISATION INSTANCE
##
@CordaSerializable
public static final class net.corda.core.flows.FinalityFlow$Companion$BROADCASTING_PRE_NOTARISATION extends net.corda.core.utilities.ProgressTracker$Step
public static final net.corda.core.flows.FinalityFlow$Companion$BROADCASTING_PRE_NOTARISATION INSTANCE
##
@CordaSerializable
public static final class net.corda.core.flows.FinalityFlow$Companion$FINALISING_TRANSACTION extends net.corda.core.utilities.ProgressTracker$Step
public static final net.corda.core.flows.FinalityFlow$Companion$FINALISING_TRANSACTION INSTANCE
##
@CordaSerializable
public static final class net.corda.core.flows.FinalityFlow$Companion$NOTARISING extends net.corda.core.utilities.ProgressTracker$Step public static final class net.corda.core.flows.FinalityFlow$Companion$NOTARISING extends net.corda.core.utilities.ProgressTracker$Step
@NotNull @NotNull
public net.corda.core.utilities.ProgressTracker childProgressTracker() public net.corda.core.utilities.ProgressTracker childProgressTracker()
public static final net.corda.core.flows.FinalityFlow$Companion$NOTARISING INSTANCE public static final net.corda.core.flows.FinalityFlow$Companion$NOTARISING INSTANCE
## ##
@CordaSerializable @CordaSerializable
public static final class net.corda.core.flows.FinalityFlow$Companion$RECORD_UNNOTARISED extends net.corda.core.utilities.ProgressTracker$Step
public static final net.corda.core.flows.FinalityFlow$Companion$RECORD_UNNOTARISED INSTANCE
##
@CordaSerializable
public class net.corda.core.flows.FlowException extends net.corda.core.CordaException implements net.corda.core.flows.IdentifiableException public class net.corda.core.flows.FlowException extends net.corda.core.CordaException implements net.corda.core.flows.IdentifiableException
public <init>() public <init>()
public <init>(String) public <init>(String)
@ -2877,6 +2922,37 @@ public static final class net.corda.core.flows.FlowStackSnapshot$Frame extends j
public String toString() public String toString()
## ##
@CordaSerializable @CordaSerializable
public final class net.corda.core.flows.FlowTransactionInfo extends java.lang.Object
public <init>(net.corda.core.flows.StateMachineRunId, String, net.corda.core.flows.TransactionStatus, java.time.Instant, net.corda.core.flows.TransactionMetadata)
@NotNull
public final net.corda.core.flows.StateMachineRunId component1()
@NotNull
public final String component2()
@NotNull
public final net.corda.core.flows.TransactionStatus component3()
@NotNull
public final java.time.Instant component4()
@Nullable
public final net.corda.core.flows.TransactionMetadata component5()
@NotNull
public final net.corda.core.flows.FlowTransactionInfo copy(net.corda.core.flows.StateMachineRunId, String, net.corda.core.flows.TransactionStatus, java.time.Instant, net.corda.core.flows.TransactionMetadata)
public boolean equals(Object)
@Nullable
public final net.corda.core.flows.TransactionMetadata getMetadata()
@NotNull
public final net.corda.core.flows.StateMachineRunId getStateMachineRunId()
@NotNull
public final net.corda.core.flows.TransactionStatus getStatus()
@NotNull
public final java.time.Instant getTimestamp()
@NotNull
public final String getTxId()
public int hashCode()
public final boolean isInitiator(net.corda.core.identity.CordaX500Name)
@NotNull
public String toString()
##
@CordaSerializable
public class net.corda.core.flows.HospitalizeFlowException extends net.corda.core.CordaRuntimeException public class net.corda.core.flows.HospitalizeFlowException extends net.corda.core.CordaRuntimeException
public <init>() public <init>()
public <init>(String) public <init>(String)
@ -3138,10 +3214,16 @@ public static final class net.corda.core.flows.NotaryFlow$Client$Companion$REQUE
public static final class net.corda.core.flows.NotaryFlow$Client$Companion$VALIDATING extends net.corda.core.utilities.ProgressTracker$Step public static final class net.corda.core.flows.NotaryFlow$Client$Companion$VALIDATING extends net.corda.core.utilities.ProgressTracker$Step
public static final net.corda.core.flows.NotaryFlow$Client$Companion$VALIDATING INSTANCE public static final net.corda.core.flows.NotaryFlow$Client$Companion$VALIDATING INSTANCE
## ##
public final class net.corda.core.flows.NotarySigCheck extends java.lang.Object
public final boolean needsNotarySignature(net.corda.core.transactions.SignedTransaction)
public static final net.corda.core.flows.NotarySigCheck INSTANCE
##
public final class net.corda.core.flows.ReceiveFinalityFlow extends net.corda.core.flows.FlowLogic public final class net.corda.core.flows.ReceiveFinalityFlow extends net.corda.core.flows.FlowLogic
public <init>(net.corda.core.flows.FlowSession) public <init>(net.corda.core.flows.FlowSession)
public <init>(net.corda.core.flows.FlowSession, net.corda.core.crypto.SecureHash) public <init>(net.corda.core.flows.FlowSession, net.corda.core.crypto.SecureHash)
public <init>(net.corda.core.flows.FlowSession, net.corda.core.crypto.SecureHash, net.corda.core.node.StatesToRecord) public <init>(net.corda.core.flows.FlowSession, net.corda.core.crypto.SecureHash, net.corda.core.node.StatesToRecord)
public <init>(net.corda.core.flows.FlowSession, net.corda.core.crypto.SecureHash, net.corda.core.node.StatesToRecord, Boolean)
public <init>(net.corda.core.flows.FlowSession, net.corda.core.crypto.SecureHash, net.corda.core.node.StatesToRecord, Boolean, int, kotlin.jvm.internal.DefaultConstructorMarker)
@Suspendable @Suspendable
@NotNull @NotNull
public net.corda.core.transactions.SignedTransaction call() public net.corda.core.transactions.SignedTransaction call()
@ -3157,6 +3239,8 @@ public class net.corda.core.flows.ReceiveTransactionFlow extends net.corda.core.
public <init>(net.corda.core.flows.FlowSession, boolean) public <init>(net.corda.core.flows.FlowSession, boolean)
public <init>(net.corda.core.flows.FlowSession, boolean, net.corda.core.node.StatesToRecord) public <init>(net.corda.core.flows.FlowSession, boolean, net.corda.core.node.StatesToRecord)
public <init>(net.corda.core.flows.FlowSession, boolean, net.corda.core.node.StatesToRecord, int, kotlin.jvm.internal.DefaultConstructorMarker) public <init>(net.corda.core.flows.FlowSession, boolean, net.corda.core.node.StatesToRecord, int, kotlin.jvm.internal.DefaultConstructorMarker)
public <init>(net.corda.core.flows.FlowSession, boolean, net.corda.core.node.StatesToRecord, boolean)
public <init>(net.corda.core.flows.FlowSession, boolean, net.corda.core.node.StatesToRecord, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker)
@Suspendable @Suspendable
@NotNull @NotNull
public net.corda.core.transactions.SignedTransaction call() public net.corda.core.transactions.SignedTransaction call()
@ -3164,6 +3248,41 @@ public class net.corda.core.flows.ReceiveTransactionFlow extends net.corda.core.
protected void checkBeforeRecording(net.corda.core.transactions.SignedTransaction) protected void checkBeforeRecording(net.corda.core.transactions.SignedTransaction)
## ##
@CordaSerializable @CordaSerializable
public final class net.corda.core.flows.RecoveryTimeWindow extends java.lang.Object
public <init>(java.time.Instant, java.time.Instant)
public <init>(java.time.Instant, java.time.Instant, int, kotlin.jvm.internal.DefaultConstructorMarker)
@NotNull
public static final net.corda.core.flows.RecoveryTimeWindow between(java.time.Instant, java.time.Instant)
@NotNull
public final java.time.Instant component1()
@NotNull
public final java.time.Instant component2()
@NotNull
public final net.corda.core.flows.RecoveryTimeWindow copy(java.time.Instant, java.time.Instant)
public boolean equals(Object)
@NotNull
public static final net.corda.core.flows.RecoveryTimeWindow fromOnly(java.time.Instant)
@NotNull
public final java.time.Instant getFromTime()
@NotNull
public final java.time.Instant getUntilTime()
public int hashCode()
@NotNull
public String toString()
@NotNull
public static final net.corda.core.flows.RecoveryTimeWindow untilOnly(java.time.Instant)
public static final net.corda.core.flows.RecoveryTimeWindow$Companion Companion
##
public static final class net.corda.core.flows.RecoveryTimeWindow$Companion extends java.lang.Object
public <init>(kotlin.jvm.internal.DefaultConstructorMarker)
@NotNull
public final net.corda.core.flows.RecoveryTimeWindow between(java.time.Instant, java.time.Instant)
@NotNull
public final net.corda.core.flows.RecoveryTimeWindow fromOnly(java.time.Instant)
@NotNull
public final net.corda.core.flows.RecoveryTimeWindow untilOnly(java.time.Instant)
##
@CordaSerializable
public final class net.corda.core.flows.ResultSerializationException extends net.corda.core.CordaRuntimeException public final class net.corda.core.flows.ResultSerializationException extends net.corda.core.CordaRuntimeException
public <init>(net.corda.core.serialization.internal.MissingSerializerException) public <init>(net.corda.core.serialization.internal.MissingSerializerException)
## ##
@ -3174,6 +3293,12 @@ public class net.corda.core.flows.SendStateAndRefFlow extends net.corda.core.flo
## ##
public class net.corda.core.flows.SendTransactionFlow extends net.corda.core.flows.DataVendingFlow public class net.corda.core.flows.SendTransactionFlow extends net.corda.core.flows.DataVendingFlow
public <init>(net.corda.core.flows.FlowSession, net.corda.core.transactions.SignedTransaction) public <init>(net.corda.core.flows.FlowSession, net.corda.core.transactions.SignedTransaction)
public static final net.corda.core.flows.SendTransactionFlow$Companion Companion
##
public static final class net.corda.core.flows.SendTransactionFlow$Companion extends java.lang.Object
public <init>(kotlin.jvm.internal.DefaultConstructorMarker)
@NotNull
public final net.corda.core.identity.CordaX500Name getDUMMY_PARTICIPANT_NAME()
## ##
public abstract class net.corda.core.flows.SignTransactionFlow extends net.corda.core.flows.FlowLogic public abstract class net.corda.core.flows.SignTransactionFlow extends net.corda.core.flows.FlowLogic
public <init>(net.corda.core.flows.FlowSession) public <init>(net.corda.core.flows.FlowSession)
@ -3209,6 +3334,24 @@ public static final class net.corda.core.flows.SignTransactionFlow$Companion$SIG
public static final class net.corda.core.flows.SignTransactionFlow$Companion$VERIFYING extends net.corda.core.utilities.ProgressTracker$Step public static final class net.corda.core.flows.SignTransactionFlow$Companion$VERIFYING extends net.corda.core.utilities.ProgressTracker$Step
public static final net.corda.core.flows.SignTransactionFlow$Companion$VERIFYING INSTANCE public static final net.corda.core.flows.SignTransactionFlow$Companion$VERIFYING INSTANCE
## ##
@CordaSerializable
public final class net.corda.core.flows.SignedTransactionWithDistributionList extends java.lang.Object
public <init>(net.corda.core.transactions.SignedTransaction, byte[])
@NotNull
public final net.corda.core.transactions.SignedTransaction component1()
@NotNull
public final byte[] component2()
@NotNull
public final net.corda.core.flows.SignedTransactionWithDistributionList copy(net.corda.core.transactions.SignedTransaction, byte[])
public boolean equals(Object)
@NotNull
public final byte[] getDistributionList()
@NotNull
public final net.corda.core.transactions.SignedTransaction getStx()
public int hashCode()
@NotNull
public String toString()
##
public final class net.corda.core.flows.StackFrameDataToken extends java.lang.Object public final class net.corda.core.flows.StackFrameDataToken extends java.lang.Object
public <init>(String) public <init>(String)
@NotNull @NotNull
@ -3281,6 +3424,29 @@ public class net.corda.core.flows.StateReplacementException extends net.corda.co
public <init>(String, Throwable, int, kotlin.jvm.internal.DefaultConstructorMarker) public <init>(String, Throwable, int, kotlin.jvm.internal.DefaultConstructorMarker)
## ##
@CordaSerializable @CordaSerializable
public final class net.corda.core.flows.TransactionMetadata extends java.lang.Object
public <init>(net.corda.core.identity.CordaX500Name, net.corda.core.flows.DistributionList)
@NotNull
public final net.corda.core.identity.CordaX500Name component1()
@NotNull
public final net.corda.core.flows.DistributionList component2()
@NotNull
public final net.corda.core.flows.TransactionMetadata copy(net.corda.core.identity.CordaX500Name, net.corda.core.flows.DistributionList)
public boolean equals(Object)
@NotNull
public final net.corda.core.flows.DistributionList getDistributionList()
@NotNull
public final net.corda.core.identity.CordaX500Name getInitiator()
public int hashCode()
@NotNull
public String toString()
##
@CordaSerializable
public final class net.corda.core.flows.TransactionStatus extends java.lang.Enum
public static net.corda.core.flows.TransactionStatus valueOf(String)
public static net.corda.core.flows.TransactionStatus[] values()
##
@CordaSerializable
public final class net.corda.core.flows.UnexpectedFlowEndException extends net.corda.core.CordaRuntimeException implements net.corda.core.flows.IdentifiableException public final class net.corda.core.flows.UnexpectedFlowEndException extends net.corda.core.CordaRuntimeException implements net.corda.core.flows.IdentifiableException
public <init>(String) public <init>(String)
public <init>(String, Throwable) public <init>(String, Throwable)
@ -4140,6 +4306,7 @@ public interface net.corda.core.node.ServicesForResolution
@NotNull @NotNull
public net.corda.core.transactions.LedgerTransaction specialise(net.corda.core.transactions.LedgerTransaction) public net.corda.core.transactions.LedgerTransaction specialise(net.corda.core.transactions.LedgerTransaction)
## ##
@CordaSerializable
public final class net.corda.core.node.StatesToRecord extends java.lang.Enum public final class net.corda.core.node.StatesToRecord extends java.lang.Enum
public static net.corda.core.node.StatesToRecord valueOf(String) public static net.corda.core.node.StatesToRecord valueOf(String)
public static net.corda.core.node.StatesToRecord[] values() public static net.corda.core.node.StatesToRecord[] values()
@ -4473,6 +4640,8 @@ public static final class net.corda.core.node.services.Vault$ConstraintInfo$Type
@CordaSerializable @CordaSerializable
public static final class net.corda.core.node.services.Vault$Page extends java.lang.Object public static final class net.corda.core.node.services.Vault$Page extends java.lang.Object
public <init>(java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends T>>, java.util.List<net.corda.core.node.services.Vault$StateMetadata>, long, net.corda.core.node.services.Vault$StateStatus, java.util.List<?>) public <init>(java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends T>>, java.util.List<net.corda.core.node.services.Vault$StateMetadata>, long, net.corda.core.node.services.Vault$StateStatus, java.util.List<?>)
public <init>(java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends T>>, java.util.List<net.corda.core.node.services.Vault$StateMetadata>, long, net.corda.core.node.services.Vault$StateStatus, java.util.List<?>, net.corda.core.contracts.StateRef)
public <init>(java.util.List, java.util.List, long, net.corda.core.node.services.Vault$StateStatus, java.util.List, net.corda.core.contracts.StateRef, int, kotlin.jvm.internal.DefaultConstructorMarker)
@NotNull @NotNull
public final java.util.List<net.corda.core.contracts.StateAndRef<T>> component1() public final java.util.List<net.corda.core.contracts.StateAndRef<T>> component1()
@NotNull @NotNull
@ -4482,11 +4651,17 @@ public static final class net.corda.core.node.services.Vault$Page extends java.l
public final net.corda.core.node.services.Vault$StateStatus component4() public final net.corda.core.node.services.Vault$StateStatus component4()
@NotNull @NotNull
public final java.util.List<Object> component5() public final java.util.List<Object> component5()
@Nullable
public final net.corda.core.contracts.StateRef component6()
@NotNull @NotNull
public final net.corda.core.node.services.Vault$Page<T> copy(java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends T>>, java.util.List<net.corda.core.node.services.Vault$StateMetadata>, long, net.corda.core.node.services.Vault$StateStatus, java.util.List<?>) public final net.corda.core.node.services.Vault$Page<T> copy(java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends T>>, java.util.List<net.corda.core.node.services.Vault$StateMetadata>, long, net.corda.core.node.services.Vault$StateStatus, java.util.List<?>)
@NotNull
public final net.corda.core.node.services.Vault$Page<T> copy(java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends T>>, java.util.List<net.corda.core.node.services.Vault$StateMetadata>, long, net.corda.core.node.services.Vault$StateStatus, java.util.List<?>, net.corda.core.contracts.StateRef)
public boolean equals(Object) public boolean equals(Object)
@NotNull @NotNull
public final java.util.List<Object> getOtherResults() public final java.util.List<Object> getOtherResults()
@Nullable
public final net.corda.core.contracts.StateRef getPreviousPageAnchor()
@NotNull @NotNull
public final net.corda.core.node.services.Vault$StateStatus getStateTypes() public final net.corda.core.node.services.Vault$StateStatus getStateTypes()
@NotNull @NotNull
@ -8383,6 +8558,8 @@ public final class net.corda.testing.driver.DriverParameters extends java.lang.O
public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map, boolean, boolean, boolean, java.util.List, java.util.List, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map, boolean, java.util.Collection, java.nio.file.Path, java.util.List, java.util.Map, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker) public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map, boolean, boolean, boolean, java.util.List, java.util.List, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map, boolean, java.util.Collection, java.nio.file.Path, java.util.List, java.util.Map, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker)
public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map<String, ?>, boolean, java.util.Collection<? extends net.corda.testing.node.TestCordapp>, java.nio.file.Path, java.util.List<? extends java.nio.file.Path>, java.util.Map<String, String>, boolean, boolean) public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map<String, ?>, boolean, java.util.Collection<? extends net.corda.testing.node.TestCordapp>, java.nio.file.Path, java.util.List<? extends java.nio.file.Path>, java.util.Map<String, String>, boolean, boolean)
public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map, boolean, boolean, boolean, java.util.List, java.util.List, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map, boolean, java.util.Collection, java.nio.file.Path, java.util.List, java.util.Map, boolean, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker) public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map, boolean, boolean, boolean, java.util.List, java.util.List, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map, boolean, java.util.Collection, java.nio.file.Path, java.util.List, java.util.Map, boolean, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker)
public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map<String, ?>, boolean, java.util.Collection<? extends net.corda.testing.node.TestCordapp>, java.nio.file.Path, java.util.List<? extends java.nio.file.Path>, java.util.Map<String, String>, boolean, boolean, java.time.Duration)
public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map, boolean, boolean, boolean, java.util.List, java.util.List, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map, boolean, java.util.Collection, java.nio.file.Path, java.util.List, java.util.Map, boolean, boolean, java.time.Duration, int, kotlin.jvm.internal.DefaultConstructorMarker)
public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, boolean) public <init>(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, boolean)
public final boolean component1() public final boolean component1()
@NotNull @NotNull
@ -8407,6 +8584,8 @@ public final class net.corda.testing.driver.DriverParameters extends java.lang.O
public final java.nio.file.Path component2() public final java.nio.file.Path component2()
public final boolean component20() public final boolean component20()
@NotNull @NotNull
public final java.time.Duration component21()
@NotNull
public final net.corda.testing.driver.PortAllocation component3() public final net.corda.testing.driver.PortAllocation component3()
@NotNull @NotNull
public final net.corda.testing.driver.PortAllocation component4() public final net.corda.testing.driver.PortAllocation component4()
@ -8426,6 +8605,8 @@ public final class net.corda.testing.driver.DriverParameters extends java.lang.O
@NotNull @NotNull
public final net.corda.testing.driver.DriverParameters copy(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map<String, ?>, boolean, java.util.Collection<? extends net.corda.testing.node.TestCordapp>, java.nio.file.Path, java.util.List<? extends java.nio.file.Path>, java.util.Map<String, String>, boolean, boolean) public final net.corda.testing.driver.DriverParameters copy(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map<String, ?>, boolean, java.util.Collection<? extends net.corda.testing.node.TestCordapp>, java.nio.file.Path, java.util.List<? extends java.nio.file.Path>, java.util.Map<String, String>, boolean, boolean)
@NotNull @NotNull
public final net.corda.testing.driver.DriverParameters copy(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Map<String, ?>, boolean, java.util.Collection<? extends net.corda.testing.node.TestCordapp>, java.nio.file.Path, java.util.List<? extends java.nio.file.Path>, java.util.Map<String, String>, boolean, boolean, java.time.Duration)
@NotNull
public final net.corda.testing.driver.DriverParameters copy(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Set<? extends net.corda.testing.node.TestCordapp>) public final net.corda.testing.driver.DriverParameters copy(boolean, java.nio.file.Path, net.corda.testing.driver.PortAllocation, net.corda.testing.driver.PortAllocation, java.util.Map<String, String>, boolean, boolean, boolean, java.util.List<net.corda.testing.node.NotarySpec>, java.util.List<String>, net.corda.testing.driver.JmxPolicy, net.corda.core.node.NetworkParameters, java.util.Set<? extends net.corda.testing.node.TestCordapp>)
public boolean equals(Object) public boolean equals(Object)
public final boolean getAllowHibernateToManageAppSchema() public final boolean getAllowHibernateToManageAppSchema()
@ -8451,6 +8632,8 @@ public final class net.corda.testing.driver.DriverParameters extends java.lang.O
@NotNull @NotNull
public final java.util.Map<String, Object> getNotaryCustomOverrides() public final java.util.Map<String, Object> getNotaryCustomOverrides()
@NotNull @NotNull
public final java.time.Duration getNotaryHandleTimeout()
@NotNull
public final java.util.List<net.corda.testing.node.NotarySpec> getNotarySpecs() public final java.util.List<net.corda.testing.node.NotarySpec> getNotarySpecs()
@NotNull @NotNull
public final net.corda.testing.driver.PortAllocation getPortAllocation() public final net.corda.testing.driver.PortAllocation getPortAllocation()
@ -8491,6 +8674,8 @@ public final class net.corda.testing.driver.DriverParameters extends java.lang.O
@NotNull @NotNull
public final net.corda.testing.driver.DriverParameters withNotaryCustomOverrides(java.util.Map<String, ?>) public final net.corda.testing.driver.DriverParameters withNotaryCustomOverrides(java.util.Map<String, ?>)
@NotNull @NotNull
public final net.corda.testing.driver.DriverParameters withNotaryHandleTimeout(java.time.Duration)
@NotNull
public final net.corda.testing.driver.DriverParameters withNotarySpecs(java.util.List<net.corda.testing.node.NotarySpec>) public final net.corda.testing.driver.DriverParameters withNotarySpecs(java.util.List<net.corda.testing.node.NotarySpec>)
@NotNull @NotNull
public final net.corda.testing.driver.DriverParameters withPortAllocation(net.corda.testing.driver.PortAllocation) public final net.corda.testing.driver.DriverParameters withPortAllocation(net.corda.testing.driver.PortAllocation)
@ -8723,6 +8908,7 @@ public final class net.corda.testing.flows.FlowTestsUtilsKt extends java.lang.Ob
public static final java.util.Map<net.corda.core.flows.FlowSession, net.corda.core.utilities.UntrustworthyData<Object>> receiveAll(net.corda.core.flows.FlowLogic<?>, kotlin.Pair<? extends net.corda.core.flows.FlowSession, ? extends Class<?>>, kotlin.Pair<? extends net.corda.core.flows.FlowSession, ? extends Class<?>>...) public static final java.util.Map<net.corda.core.flows.FlowSession, net.corda.core.utilities.UntrustworthyData<Object>> receiveAll(net.corda.core.flows.FlowLogic<?>, kotlin.Pair<? extends net.corda.core.flows.FlowSession, ? extends Class<?>>, kotlin.Pair<? extends net.corda.core.flows.FlowSession, ? extends Class<?>>...)
@NotNull @NotNull
public static final rx.Observable<T> registerCoreFlowFactory(net.corda.testing.node.internal.TestStartedNode, Class<? extends net.corda.core.flows.FlowLogic<?>>, Class<T>, kotlin.jvm.functions.Function1<? super net.corda.core.flows.FlowSession, ? extends T>, boolean) public static final rx.Observable<T> registerCoreFlowFactory(net.corda.testing.node.internal.TestStartedNode, Class<? extends net.corda.core.flows.FlowLogic<?>>, Class<T>, kotlin.jvm.functions.Function1<? super net.corda.core.flows.FlowSession, ? extends T>, boolean)
public static final void waitForAllFlowsToComplete(net.corda.testing.driver.NodeHandle, int, long)
## ##
@DoNotImplement @DoNotImplement
public abstract class net.corda.testing.node.ClusterSpec extends java.lang.Object public abstract class net.corda.testing.node.ClusterSpec extends java.lang.Object
@ -9144,7 +9330,9 @@ public class net.corda.testing.node.MockServices extends java.lang.Object implem
@NotNull @NotNull
public static final kotlin.Pair<net.corda.nodeapi.internal.persistence.CordaPersistence, net.corda.testing.node.MockServices> makeTestDatabaseAndPersistentServices(java.util.List<String>, net.corda.testing.core.TestIdentity, net.corda.core.node.NetworkParameters, java.util.Set<java.security.KeyPair>, java.util.Set<net.corda.core.identity.PartyAndCertificate>, net.corda.testing.internal.TestingNamedCacheFactory) public static final kotlin.Pair<net.corda.nodeapi.internal.persistence.CordaPersistence, net.corda.testing.node.MockServices> makeTestDatabaseAndPersistentServices(java.util.List<String>, net.corda.testing.core.TestIdentity, net.corda.core.node.NetworkParameters, java.util.Set<java.security.KeyPair>, java.util.Set<net.corda.core.identity.PartyAndCertificate>, net.corda.testing.internal.TestingNamedCacheFactory)
public void recordTransactions(Iterable<net.corda.core.transactions.SignedTransaction>) public void recordTransactions(Iterable<net.corda.core.transactions.SignedTransaction>)
public final void recordTransactions(Iterable<net.corda.core.transactions.SignedTransaction>, boolean)
public void recordTransactions(net.corda.core.node.StatesToRecord, Iterable<net.corda.core.transactions.SignedTransaction>) public void recordTransactions(net.corda.core.node.StatesToRecord, Iterable<net.corda.core.transactions.SignedTransaction>)
public final void recordTransactions(net.corda.core.transactions.SignedTransaction, boolean)
public void recordTransactions(net.corda.core.transactions.SignedTransaction, net.corda.core.transactions.SignedTransaction...) public void recordTransactions(net.corda.core.transactions.SignedTransaction, net.corda.core.transactions.SignedTransaction...)
public void recordTransactions(boolean, Iterable<net.corda.core.transactions.SignedTransaction>) public void recordTransactions(boolean, Iterable<net.corda.core.transactions.SignedTransaction>)
public void recordTransactions(boolean, net.corda.core.transactions.SignedTransaction, net.corda.core.transactions.SignedTransaction...) public void recordTransactions(boolean, net.corda.core.transactions.SignedTransaction, net.corda.core.transactions.SignedTransaction...)

View File

@ -10,7 +10,6 @@ import net.corda.core.contracts.StateAndRef
import net.corda.core.contracts.TransactionVerificationException import net.corda.core.contracts.TransactionVerificationException
import net.corda.core.crypto.SecureHash import net.corda.core.crypto.SecureHash
import net.corda.core.crypto.TransactionSignature import net.corda.core.crypto.TransactionSignature
import net.corda.core.flows.DistributionList
import net.corda.core.flows.FinalityFlow import net.corda.core.flows.FinalityFlow
import net.corda.core.flows.FlowException import net.corda.core.flows.FlowException
import net.corda.core.flows.FlowLogic import net.corda.core.flows.FlowLogic
@ -24,7 +23,6 @@ import net.corda.core.flows.ReceiveFinalityFlow
import net.corda.core.flows.ReceiveTransactionFlow import net.corda.core.flows.ReceiveTransactionFlow
import net.corda.core.flows.SendTransactionFlow import net.corda.core.flows.SendTransactionFlow
import net.corda.core.flows.StartableByRPC import net.corda.core.flows.StartableByRPC
import net.corda.core.flows.TransactionMetadata
import net.corda.core.flows.TransactionStatus import net.corda.core.flows.TransactionStatus
import net.corda.core.flows.UnexpectedFlowEndException import net.corda.core.flows.UnexpectedFlowEndException
import net.corda.core.identity.CordaX500Name import net.corda.core.identity.CordaX500Name
@ -581,8 +579,7 @@ class FinalityFlowTests : WithFinality {
val txBuilder = DummyContract.move(stateAndRef, newOwner) val txBuilder = DummyContract.move(stateAndRef, newOwner)
val stxn = serviceHub.signInitialTransaction(txBuilder, ourIdentity.owningKey) val stxn = serviceHub.signInitialTransaction(txBuilder, ourIdentity.owningKey)
val sessionWithCounterParty = initiateFlow(newOwner) val sessionWithCounterParty = initiateFlow(newOwner)
subFlow(SendTransactionFlow(sessionWithCounterParty, stxn, subFlow(SendTransactionFlow(stxn, setOf(sessionWithCounterParty), emptySet(), StatesToRecord.ONLY_RELEVANT))
TransactionMetadata(ourIdentity.name, DistributionList(StatesToRecord.ONLY_RELEVANT, mapOf(BOB_NAME to StatesToRecord.ONLY_RELEVANT)))))
throw UnexpectedFlowEndException("${stxn.id}") throw UnexpectedFlowEndException("${stxn.id}")
} }
} }

View File

@ -15,7 +15,7 @@ class TestNoSecurityDataVendingFlow(otherSideSession: FlowSession) : DataVending
// Hack to not send the first message. // Hack to not send the first message.
otherSideSession.receive() otherSideSession.receive()
} else { } else {
super.sendPayloadAndReceiveDataRequest(this.otherSideSession, payload) super.sendPayloadAndReceiveDataRequest(this.otherSessions.first(), payload)
} }
} }
} }

View File

@ -6,7 +6,6 @@ import net.corda.core.crypto.SecureHash
import net.corda.core.crypto.TransactionSignature import net.corda.core.crypto.TransactionSignature
import net.corda.core.crypto.isFulfilledBy import net.corda.core.crypto.isFulfilledBy
import net.corda.core.flows.NotarySigCheck.needsNotarySignature import net.corda.core.flows.NotarySigCheck.needsNotarySignature
import net.corda.core.identity.CordaX500Name
import net.corda.core.identity.Party import net.corda.core.identity.Party
import net.corda.core.identity.groupAbstractPartyByWellKnownParty import net.corda.core.identity.groupAbstractPartyByWellKnownParty
import net.corda.core.internal.FetchDataFlow import net.corda.core.internal.FetchDataFlow
@ -16,7 +15,6 @@ import net.corda.core.internal.pushToLoggingContext
import net.corda.core.internal.telemetry.telemetryServiceInternal import net.corda.core.internal.telemetry.telemetryServiceInternal
import net.corda.core.internal.warnOnce import net.corda.core.internal.warnOnce
import net.corda.core.node.StatesToRecord import net.corda.core.node.StatesToRecord
import net.corda.core.node.StatesToRecord.ALL_VISIBLE
import net.corda.core.node.StatesToRecord.ONLY_RELEVANT import net.corda.core.node.StatesToRecord.ONLY_RELEVANT
import net.corda.core.transactions.LedgerTransaction import net.corda.core.transactions.LedgerTransaction
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
@ -169,7 +167,6 @@ class FinalityFlow private constructor(val transaction: SignedTransaction,
} }
private lateinit var externalTxParticipants: Set<Party> private lateinit var externalTxParticipants: Set<Party>
private lateinit var txnMetadata: TransactionMetadata
@Suspendable @Suspendable
@Suppress("ComplexMethod", "NestedBlockDepth") @Suppress("ComplexMethod", "NestedBlockDepth")
@ -221,8 +218,7 @@ class FinalityFlow private constructor(val transaction: SignedTransaction,
val requiresNotarisation = needsNotarySignature(transaction) val requiresNotarisation = needsNotarySignature(transaction)
val useTwoPhaseFinality = serviceHub.myInfo.platformVersion >= PlatformVersionSwitches.TWO_PHASE_FINALITY val useTwoPhaseFinality = serviceHub.myInfo.platformVersion >= PlatformVersionSwitches.TWO_PHASE_FINALITY
txnMetadata = TransactionMetadata(serviceHub.myInfo.legalIdentities.first().name,
DistributionList(statesToRecord, deriveStatesToRecord(newPlatformSessions)))
if (useTwoPhaseFinality) { if (useTwoPhaseFinality) {
val stxn = if (requiresNotarisation) { val stxn = if (requiresNotarisation) {
recordLocallyAndBroadcast(newPlatformSessions, transaction) recordLocallyAndBroadcast(newPlatformSessions, transaction)
@ -283,29 +279,24 @@ class FinalityFlow private constructor(val transaction: SignedTransaction,
@Suspendable @Suspendable
private fun broadcast(sessions: Collection<FlowSession>, tx: SignedTransaction) { private fun broadcast(sessions: Collection<FlowSession>, tx: SignedTransaction) {
serviceHub.telemetryServiceInternal.span("${this::class.java.name}#broadcast", flowLogic = this) { serviceHub.telemetryServiceInternal.span("${this::class.java.name}#broadcast", flowLogic = this) {
sessions.forEach { session -> try {
try { logger.debug { "Sending transaction to party sessions: $sessions." }
logger.debug { "Sending transaction to party $session." } val (participantSessions, observerSessions) = deriveSessions(sessions)
subFlow(SendTransactionFlow(session, tx, txnMetadata)) subFlow(SendTransactionFlow(tx, participantSessions, observerSessions, statesToRecord))
txnMetadata = txnMetadata.copy(persist = false) } catch (e: UnexpectedFlowEndException) {
} catch (e: UnexpectedFlowEndException) { throw UnexpectedFlowEndException(
throw UnexpectedFlowEndException( "One of the sessions ${sessions.map { it.counterparty }} has finished prematurely and we're trying to send them a transaction." +
"${session.counterparty} has finished prematurely and we're trying to send them a transaction." + "Did they forget to call ReceiveFinalityFlow? (${e.message})",
"Did they forget to call ReceiveFinalityFlow? (${e.message})", e.cause,
e.cause, e.originalErrorId
e.originalErrorId )
)
}
} }
} }
} }
private fun deriveStatesToRecord(newPlatformSessions: Collection<FlowSession>): Map<CordaX500Name, StatesToRecord> { private fun deriveSessions(newPlatformSessions: Collection<FlowSession>) =
val derivedObserverSessions = newPlatformSessions.map { it.counterparty }.toSet() - externalTxParticipants Pair(newPlatformSessions.filter { it.counterparty in externalTxParticipants }.toSet(),
val txParticipantSessions = externalTxParticipants (observerSessions + newPlatformSessions.filter { it.counterparty !in externalTxParticipants }).toSet())
return txParticipantSessions.map { it.name to ONLY_RELEVANT }.toMap() +
(derivedObserverSessions + observerSessions.map { it.counterparty }).map { it.name to ALL_VISIBLE }
}
@Suspendable @Suspendable
private fun broadcastSignaturesAndFinalise(sessions: Collection<FlowSession>, notarySignatures: List<TransactionSignature>) { private fun broadcastSignaturesAndFinalise(sessions: Collection<FlowSession>, notarySignatures: List<TransactionSignature>) {
@ -373,19 +364,16 @@ class FinalityFlow private constructor(val transaction: SignedTransaction,
logger.info("Broadcasting complete transaction to other participants.") logger.info("Broadcasting complete transaction to other participants.")
if (newApi) { if (newApi) {
oldV3Broadcast(tx, oldParticipants.toSet()) oldV3Broadcast(tx, oldParticipants.toSet())
for (session in sessions) { try {
try { logger.debug { "Sending transaction to party sessions $sessions." }
logger.debug { "Sending transaction to party $session." } subFlow(SendTransactionFlow(tx, sessions.toSet(), emptySet(), statesToRecord))
subFlow(SendTransactionFlow(session, tx, txnMetadata)) } catch (e: UnexpectedFlowEndException) {
txnMetadata = txnMetadata.copy(persist = false) throw UnexpectedFlowEndException(
} catch (e: UnexpectedFlowEndException) { "One of the sessions ${sessions.map { it.counterparty }} has finished prematurely and we're trying to send them the finalised transaction. " +
throw UnexpectedFlowEndException( "Did they forget to call ReceiveFinalityFlow? (${e.message})",
"${session.counterparty} has finished prematurely and we're trying to send them the finalised transaction. " + e.cause,
"Did they forget to call ReceiveFinalityFlow? (${e.message})", e.originalErrorId
e.cause, )
e.originalErrorId
)
}
} }
} else { } else {
oldV3Broadcast(tx, (externalTxParticipants + oldParticipants).toSet()) oldV3Broadcast(tx, (externalTxParticipants + oldParticipants).toSet())
@ -396,15 +384,11 @@ class FinalityFlow private constructor(val transaction: SignedTransaction,
@Suspendable @Suspendable
private fun oldV3Broadcast(notarised: SignedTransaction, recipients: Set<Party>) { private fun oldV3Broadcast(notarised: SignedTransaction, recipients: Set<Party>) {
for (recipient in recipients) { val remoteRecipients = recipients.filter { !serviceHub.myInfo.isLegalIdentity(it) }
if (!serviceHub.myInfo.isLegalIdentity(recipient)) { logger.debug { "Sending transaction to parties $remoteRecipients." }
logger.debug { "Sending transaction to party $recipient." } val sessions = remoteRecipients.map { initiateFlow(it) }.toSet()
val session = initiateFlow(recipient) subFlow(SendTransactionFlow(notarised, sessions, emptySet(), statesToRecord))
subFlow(SendTransactionFlow(session, notarised, txnMetadata)) logger.info("Parties $remoteRecipients received the transaction.")
txnMetadata = txnMetadata.copy(persist = false)
logger.info("Party $recipient received the transaction.")
}
}
} }
private fun logCommandData() { private fun logCommandData() {

View File

@ -23,9 +23,8 @@ data class FlowTransactionInfo(
@CordaSerializable @CordaSerializable
data class TransactionMetadata( data class TransactionMetadata(
val initiator: CordaX500Name, val initiator: CordaX500Name,
val distributionList: DistributionList, val distributionList: DistributionList
val persist: Boolean = true // hint to persist to transactional store
) )
@CordaSerializable @CordaSerializable

View File

@ -74,14 +74,22 @@ class MaybeSerializedSignedTransaction(override val id: SecureHash, val serializ
* the right point in the conversation to receive the sent transaction and perform the resolution back-and-forth required * the right point in the conversation to receive the sent transaction and perform the resolution back-and-forth required
* to check the dependencies and download any missing attachments. * to check the dependencies and download any missing attachments.
* *
* @param otherSide the target party. * @param stx the [SignedTransaction] being sent to the [otherSessions].
* @param stx the [SignedTransaction] being sent to the [otherSideSession]. * @param participantSessions the target parties which are participants to the transaction.
* @property txnMetadata transaction recovery metadata (eg. used by Two Phase Finality). * @param observerSessions the target parties which are observers to the transaction.
* @param senderStatesToRecord the [StatesToRecord] relevancy information of the sender.
*/ */
open class SendTransactionFlow(otherSide: FlowSession, stx: SignedTransaction, txnMetadata: TransactionMetadata) : DataVendingFlow(otherSide, stx, txnMetadata) { open class SendTransactionFlow(val stx: SignedTransaction,
constructor(otherSide: FlowSession, stx: SignedTransaction) : this(otherSide, stx, val participantSessions: Set<FlowSession>,
TransactionMetadata(DUMMY_PARTICIPANT_NAME, DistributionList(StatesToRecord.NONE, mapOf(otherSide.counterparty.name to StatesToRecord.ALL_VISIBLE)))) val observerSessions: Set<FlowSession>,
// Note: DUMMY_PARTICIPANT_NAME to be substituted with actual "ourIdentity.name" in flow call() val senderStatesToRecord: StatesToRecord) : DataVendingFlow(participantSessions + observerSessions, stx,
TransactionMetadata(DUMMY_PARTICIPANT_NAME,
DistributionList(senderStatesToRecord,
(participantSessions.map { it.counterparty.name to StatesToRecord.ONLY_RELEVANT}).toMap() +
(observerSessions.map { it.counterparty.name to StatesToRecord.ALL_VISIBLE}).toMap()
))) {
constructor(otherSide: FlowSession, stx: SignedTransaction) : this(stx, setOf(otherSide), emptySet(), StatesToRecord.NONE)
// Note: DUMMY_PARTICIPANT_NAME to be substituted with actual "ourIdentity.name" in flow call()
companion object { companion object {
val DUMMY_PARTICIPANT_NAME = CordaX500Name("Transaction Participant", "London", "GB") val DUMMY_PARTICIPANT_NAME = CordaX500Name("Transaction Participant", "London", "GB")
} }
@ -98,7 +106,8 @@ open class SendTransactionFlow(otherSide: FlowSession, stx: SignedTransaction, t
*/ */
open class SendStateAndRefFlow(otherSideSession: FlowSession, stateAndRefs: List<StateAndRef<*>>) : DataVendingFlow(otherSideSession, stateAndRefs) open class SendStateAndRefFlow(otherSideSession: FlowSession, stateAndRefs: List<StateAndRef<*>>) : DataVendingFlow(otherSideSession, stateAndRefs)
open class DataVendingFlow(val otherSideSession: FlowSession, val payload: Any, val txnMetadata: TransactionMetadata? = null) : FlowLogic<Void?>() { open class DataVendingFlow(val otherSessions: Set<FlowSession>, val payload: Any, private val txnMetadata: TransactionMetadata? = null) : FlowLogic<Void?>() {
constructor(otherSideSession: FlowSession, payload: Any, txnMetadata: TransactionMetadata? = null) : this(setOf(otherSideSession), payload, txnMetadata)
constructor(otherSideSession: FlowSession, payload: Any) : this(otherSideSession, payload, null) constructor(otherSideSession: FlowSession, payload: Any) : this(otherSideSession, payload, null)
@Suspendable @Suspendable
@ -109,7 +118,7 @@ open class DataVendingFlow(val otherSideSession: FlowSession, val payload: Any,
// User can override this method to perform custom request verification. // User can override this method to perform custom request verification.
} }
@Suppress("ComplexCondition", "ComplexMethod") @Suppress("ComplexCondition", "ComplexMethod", "LongMethod")
@Suspendable @Suspendable
override fun call(): Void? { override fun call(): Void? {
val networkMaxMessageSize = serviceHub.networkParameters.maxMessageSize val networkMaxMessageSize = serviceHub.networkParameters.maxMessageSize
@ -140,115 +149,126 @@ open class DataVendingFlow(val otherSideSession: FlowSession, val payload: Any,
// store and share transaction recovery metadata if required // store and share transaction recovery metadata if required
val useTwoPhaseFinality = serviceHub.myInfo.platformVersion >= PlatformVersionSwitches.TWO_PHASE_FINALITY val useTwoPhaseFinality = serviceHub.myInfo.platformVersion >= PlatformVersionSwitches.TWO_PHASE_FINALITY
val toTwoPhaseFinalityNode = serviceHub.networkMapCache.getNodeByLegalIdentity(otherSideSession.counterparty)?.platformVersion!! >= PlatformVersionSwitches.TWO_PHASE_FINALITY val toTwoPhaseFinalityNode = otherSessions.any { otherSideSession ->
if (txnMetadata != null && toTwoPhaseFinalityNode && useTwoPhaseFinality && payload is SignedTransaction) { serviceHub.networkMapCache.getNodeByLegalIdentity(otherSideSession.counterparty)?.platformVersion!! >= PlatformVersionSwitches.TWO_PHASE_FINALITY
val encryptedDistributionList = (serviceHub as ServiceHubCoreInternal).recordSenderTransactionRecoveryMetadata(payload.id, txnMetadata.copy(initiator = ourIdentity.name))
payload = SignedTransactionWithDistributionList(payload, encryptedDistributionList!!)
} }
// record transaction recovery metadata once
val payloadWithMetadata =
if (txnMetadata != null && toTwoPhaseFinalityNode && useTwoPhaseFinality && payload is SignedTransaction) {
val encryptedDistributionList = (serviceHub as ServiceHubCoreInternal).recordSenderTransactionRecoveryMetadata(payload.id, txnMetadata.copy(initiator = ourIdentity.name))
SignedTransactionWithDistributionList(payload, encryptedDistributionList!!)
} else null
// This loop will receive [FetchDataFlow.Request] continuously until the `otherSideSession` has all the data they need otherSessions.forEachIndexed { idx, otherSideSession ->
// to resolve the transaction, a [FetchDataFlow.EndRequest] will be sent from the `otherSideSession` to indicate end of if (payloadWithMetadata != null)
// data request. payload = payloadWithMetadata
var loopCount = 0 // This loop will receive [FetchDataFlow.Request] continuously until the `otherSideSession` has all the data they need
while (true) { // to resolve the transaction, a [FetchDataFlow.EndRequest] will be sent from the `otherSideSession` to indicate end of
val loopCnt = loopCount++ // data request.
logger.trace { "DataVendingFlow: Main While [$loopCnt]..." } var loopCount = 0
val dataRequest = sendPayloadAndReceiveDataRequest(otherSideSession, payload).unwrap { request -> while (true) {
logger.trace { "sendPayloadAndReceiveDataRequest(): ${request.javaClass.name}" } val loopCnt = loopCount++
when (request) { logger.trace { "DataVendingFlow: Main While [$loopCnt]..." }
is FetchDataFlow.Request.Data -> { val dataRequest = sendPayloadAndReceiveDataRequest(otherSideSession, payload).unwrap { request ->
// Security TODO: Check for abnormally large or malformed data requests logger.trace { "sendPayloadAndReceiveDataRequest(): ${request.javaClass.name}" }
verifyDataRequest(request) when (request) {
request is FetchDataFlow.Request.Data -> {
} // Security TODO: Check for abnormally large or malformed data requests
FetchDataFlow.Request.End -> { verifyDataRequest(request)
logger.trace { "DataVendingFlow: END" } request
return null }
FetchDataFlow.Request.End -> {
logger.trace { "DataVendingFlow: END" }
return@forEachIndexed
}
} }
} }
}
logger.trace { "Sending data (Type = ${dataRequest.dataType.name})" } logger.trace { "Sending data (Type = ${dataRequest.dataType.name})" }
var totalByteCount = 0 var totalByteCount = 0
var firstItem = true var firstItem = true
var batchFetchCountExceeded = false var batchFetchCountExceeded = false
var numSent = 0 var numSent = 0
payload = when (dataRequest.dataType) { payload = when (dataRequest.dataType) {
FetchDataFlow.DataType.TRANSACTION -> dataRequest.hashes.map { txId -> FetchDataFlow.DataType.TRANSACTION -> dataRequest.hashes.map { txId ->
logger.trace { "Sending: TRANSACTION (dataRequest.hashes.size=${dataRequest.hashes.size})" } logger.trace { "Sending: TRANSACTION (dataRequest.hashes.size=${dataRequest.hashes.size})" }
if (!authorisedTransactions.isAuthorised(txId)) { if (!authorisedTransactions.isAuthorised(txId)) {
throw FetchDataFlow.IllegalTransactionRequest(txId) throw FetchDataFlow.IllegalTransactionRequest(txId)
} }
val tx = serviceHub.validatedTransactions.getTransaction(txId)
?: throw FetchDataFlow.HashNotFound(txId)
authorisedTransactions.removeAuthorised(tx.id)
authorisedTransactions.addAuthorised(getInputTransactions(tx))
totalByteCount += tx.txBits.size
numSent++
tx
}
// Loop on all items returned using dataRequest.hashes.map:
FetchDataFlow.DataType.BATCH_TRANSACTION -> dataRequest.hashes.map { txId ->
if (!authorisedTransactions.isAuthorised(txId)) {
throw FetchDataFlow.IllegalTransactionRequest(txId)
}
// Maybe we should not just throw here as it's not recoverable on the client side. Might be better to send a reason code or
// remove the restriction on sending once.
logger.trace { "Transaction authorised OK: '$txId'" }
var serialized: SerializedBytes<SignedTransaction>? = null
if (!batchFetchCountExceeded) {
// Only fetch and serialize if we have not already exceeded the maximum byte count. Once we have, no more fetching
// is required, just reject all additional items.
val tx = serviceHub.validatedTransactions.getTransaction(txId) val tx = serviceHub.validatedTransactions.getTransaction(txId)
?: throw FetchDataFlow.HashNotFound(txId) ?: throw FetchDataFlow.HashNotFound(txId)
logger.trace { "Transaction get OK: '$txId'" } if (idx == otherSessions.size - 1)
serialized = tx.serialize()
val itemByteCount = serialized.size
logger.trace { "Batch-Send '$txId': first = $firstItem, Total bytes = $totalByteCount, Item byte count = $itemByteCount, Maximum = $maxPayloadSize" }
if (firstItem || (totalByteCount + itemByteCount) < maxPayloadSize) {
totalByteCount += itemByteCount
numSent++
// Always include at least one item else if the max is set too low nothing will ever get returned.
// Splitting items will be a separate Jira if need be
authorisedTransactions.removeAuthorised(tx.id) authorisedTransactions.removeAuthorised(tx.id)
authorisedTransactions.addAuthorised(getInputTransactions(tx)) authorisedTransactions.addAuthorised(getInputTransactions(tx))
logger.trace { "Adding item to return set: '$txId'" } totalByteCount += tx.txBits.size
} else { numSent++
logger.trace { "Fetch block size EXCEEDED at '$txId'." } tx
batchFetchCountExceeded = true
}
} // end
if (batchFetchCountExceeded) {
logger.trace { "Excluding '$txId' from return set due to exceeded count." }
} }
// Loop on all items returned using dataRequest.hashes.map:
FetchDataFlow.DataType.BATCH_TRANSACTION -> dataRequest.hashes.map { txId ->
if (!authorisedTransactions.isAuthorised(txId)) {
throw FetchDataFlow.IllegalTransactionRequest(txId)
}
// Maybe we should not just throw here as it's not recoverable on the client side. Might be better to send a reason code or
// remove the restriction on sending once.
logger.trace { "Transaction authorised OK: '$txId'" }
var serialized: SerializedBytes<SignedTransaction>? = null
if (!batchFetchCountExceeded) {
// Only fetch and serialize if we have not already exceeded the maximum byte count. Once we have, no more fetching
// is required, just reject all additional items.
val tx = serviceHub.validatedTransactions.getTransaction(txId)
?: throw FetchDataFlow.HashNotFound(txId)
logger.trace { "Transaction get OK: '$txId'" }
serialized = tx.serialize()
// Send null if limit is exceeded val itemByteCount = serialized.size
val maybeserialized = MaybeSerializedSignedTransaction(txId, if (batchFetchCountExceeded) { logger.trace { "Batch-Send '$txId': first = $firstItem, Total bytes = $totalByteCount, Item byte count = $itemByteCount, Maximum = $maxPayloadSize" }
null if (firstItem || (totalByteCount + itemByteCount) < maxPayloadSize) {
} else { totalByteCount += itemByteCount
serialized numSent++
}, null) // Always include at least one item else if the max is set too low nothing will ever get returned.
firstItem = false // Splitting items will be a separate Jira if need be
maybeserialized if (idx == otherSessions.size - 1)
} // Batch response loop end authorisedTransactions.removeAuthorised(tx.id)
FetchDataFlow.DataType.ATTACHMENT -> dataRequest.hashes.map { authorisedTransactions.addAuthorised(getInputTransactions(tx))
logger.trace { "Sending: Attachments for '$it'" } logger.trace { "Adding item to return set: '$txId'" }
serviceHub.attachments.openAttachment(it)?.open()?.readFully() } else {
?: throw FetchDataFlow.HashNotFound(it) logger.trace { "Fetch block size EXCEEDED at '$txId'." }
} batchFetchCountExceeded = true
FetchDataFlow.DataType.PARAMETERS -> dataRequest.hashes.map { }
logger.trace { "Sending: Parameters for '$it'" } } // end
(serviceHub.networkParametersService as NetworkParametersStorage).lookupSigned(it)
?: throw FetchDataFlow.MissingNetworkParameters(it) if (batchFetchCountExceeded) {
} logger.trace { "Excluding '$txId' from return set due to exceeded count." }
FetchDataFlow.DataType.UNKNOWN -> dataRequest.hashes.map { }
logger.warn("Message from from a future version of Corda with UNKNOWN enum value for FetchDataFlow.DataType: ID='$it'")
// Send null if limit is exceeded
val maybeserialized = MaybeSerializedSignedTransaction(txId, if (batchFetchCountExceeded) {
null
} else {
serialized
}, null)
firstItem = false
maybeserialized
} // Batch response loop end
FetchDataFlow.DataType.ATTACHMENT -> dataRequest.hashes.map {
logger.trace { "Sending: Attachments for '$it'" }
serviceHub.attachments.openAttachment(it)?.open()?.readFully()
?: throw FetchDataFlow.HashNotFound(it)
}
FetchDataFlow.DataType.PARAMETERS -> dataRequest.hashes.map {
logger.trace { "Sending: Parameters for '$it'" }
(serviceHub.networkParametersService as NetworkParametersStorage).lookupSigned(it)
?: throw FetchDataFlow.MissingNetworkParameters(it)
}
FetchDataFlow.DataType.UNKNOWN -> dataRequest.hashes.map {
logger.warn("Message from from a future version of Corda with UNKNOWN enum value for FetchDataFlow.DataType: ID='$it'")
}
} }
logger.trace { "Block total size = $totalByteCount: Num Items = ($numSent of ${dataRequest.hashes.size} total)" }
} }
logger.trace { "Block total size = $totalByteCount: Num Items = ($numSent of ${dataRequest.hashes.size} total)" }
} }
return null
} }
@Suspendable @Suspendable

View File

@ -26,6 +26,7 @@ import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
@Suppress("FunctionName") @Suppress("FunctionName")
@Ignore("flaky tests in CI")
class DeterministicContractWithCustomSerializerTest { class DeterministicContractWithCustomSerializerTest {
companion object { companion object {
val logger = loggerFor<DeterministicContractWithCustomSerializerTest>() val logger = loggerFor<DeterministicContractWithCustomSerializerTest>()
@ -61,7 +62,6 @@ class DeterministicContractWithCustomSerializerTest {
} }
@Test(timeout=300_000) @Test(timeout=300_000)
@Ignore("Flaky test in CI: org.opentest4j.AssertionFailedError: Unexpected exception thrown: net.corda.client.rpc.RPCException: Class \"class net.corda.contracts.serialization.custom.Currantsy\" is not on the whitelist or annotated with @CordaSerializable.")
fun `test DJVM can verify using custom serializer`() { fun `test DJVM can verify using custom serializer`() {
driver(parametersFor(djvmSources, listOf(flowCordapp, contractCordapp))) { driver(parametersFor(djvmSources, listOf(flowCordapp, contractCordapp))) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow() val alice = startNode(providedName = ALICE_NAME).getOrThrow()

View File

@ -38,11 +38,14 @@ import net.corda.core.internal.VisibleForTesting
import net.corda.core.internal.concurrent.flatMap import net.corda.core.internal.concurrent.flatMap
import net.corda.core.internal.concurrent.map import net.corda.core.internal.concurrent.map
import net.corda.core.internal.concurrent.openFuture import net.corda.core.internal.concurrent.openFuture
import net.corda.core.internal.concurrent.thenMatch
import net.corda.core.internal.div import net.corda.core.internal.div
import net.corda.core.internal.messaging.AttachmentTrustInfoRPCOps import net.corda.core.internal.messaging.AttachmentTrustInfoRPCOps
import net.corda.core.internal.notary.NotaryService import net.corda.core.internal.notary.NotaryService
import net.corda.core.internal.rootMessage import net.corda.core.internal.rootMessage
import net.corda.core.internal.telemetry.OpenTelemetryComponent
import net.corda.core.internal.telemetry.SimpleLogTelemetryComponent
import net.corda.core.internal.telemetry.TelemetryComponent
import net.corda.core.internal.telemetry.TelemetryServiceImpl
import net.corda.core.internal.uncheckedCast import net.corda.core.internal.uncheckedCast
import net.corda.core.messaging.ClientRpcSslOptions import net.corda.core.messaging.ClientRpcSslOptions
import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.CordaRPCOps
@ -57,10 +60,6 @@ import net.corda.core.node.services.ContractUpgradeService
import net.corda.core.node.services.CordaService import net.corda.core.node.services.CordaService
import net.corda.core.node.services.IdentityService import net.corda.core.node.services.IdentityService
import net.corda.core.node.services.KeyManagementService import net.corda.core.node.services.KeyManagementService
import net.corda.core.internal.telemetry.SimpleLogTelemetryComponent
import net.corda.core.internal.telemetry.TelemetryComponent
import net.corda.core.internal.telemetry.OpenTelemetryComponent
import net.corda.core.internal.telemetry.TelemetryServiceImpl
import net.corda.core.node.services.TelemetryService import net.corda.core.node.services.TelemetryService
import net.corda.core.node.services.TransactionVerifierService import net.corda.core.node.services.TransactionVerifierService
import net.corda.core.node.services.diagnostics.DiagnosticsService import net.corda.core.node.services.diagnostics.DiagnosticsService
@ -659,6 +658,8 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
tokenizableServices = null tokenizableServices = null
verifyCheckpointsCompatible(frozenTokenizableServices) verifyCheckpointsCompatible(frozenTokenizableServices)
partyInfoCache.start()
/* Note the .get() at the end of the distributeEvent call, below. /* Note the .get() at the end of the distributeEvent call, below.
This will block until all Corda Services have returned from processing the event, allowing a service to prevent the This will block until all Corda Services have returned from processing the event, allowing a service to prevent the
state machine manager from starting (just below this) until the service is ready. state machine manager from starting (just below this) until the service is ready.
@ -697,9 +698,6 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
log.warn("Not distributing events as NetworkMap is not ready") log.warn("Not distributing events as NetworkMap is not ready")
} }
} }
nodeReadyFuture.thenMatch({
partyInfoCache.start()
}, { th -> log.error("Unexpected exception during cache initialisation", th) })
setNodeStatus(NodeStatus.STARTED) setNodeStatus(NodeStatus.STARTED)
return resultingNodeInfo return resultingNodeInfo

View File

@ -141,14 +141,13 @@ class DBTransactionStorageLedgerRecovery(private val database: CordaPersistence,
override fun addSenderTransactionRecoveryMetadata(id: SecureHash, metadata: TransactionMetadata): ByteArray { override fun addSenderTransactionRecoveryMetadata(id: SecureHash, metadata: TransactionMetadata): ByteArray {
return database.transaction { return database.transaction {
if (metadata.persist) metadata.distributionList.peersToStatesToRecord.map { (peer, _) ->
metadata.distributionList.peersToStatesToRecord.map { (peer, _) -> val senderDistributionRecord = DBSenderDistributionRecord(PersistentKey(Key(clock.instant())),
val senderDistributionRecord = DBSenderDistributionRecord(PersistentKey(Key(clock.instant())), id.toString(),
id.toString(), partyInfoCache.getPartyIdByCordaX500Name(peer),
partyInfoCache.getPartyIdByCordaX500Name(peer), metadata.distributionList.senderStatesToRecord)
metadata.distributionList.senderStatesToRecord) session.save(senderDistributionRecord)
session.save(senderDistributionRecord) }
}
val hashedPeersToStatesToRecord = metadata.distributionList.peersToStatesToRecord.map { (peer, statesToRecord) -> val hashedPeersToStatesToRecord = metadata.distributionList.peersToStatesToRecord.map { (peer, statesToRecord) ->
partyInfoCache.getPartyIdByCordaX500Name(peer) to statesToRecord }.toMap() partyInfoCache.getPartyIdByCordaX500Name(peer) to statesToRecord }.toMap()
val hashedDistributionList = HashedDistributionList(metadata.distributionList.senderStatesToRecord, hashedPeersToStatesToRecord) val hashedDistributionList = HashedDistributionList(metadata.distributionList.senderStatesToRecord, hashedPeersToStatesToRecord)