FinalityFlow
Keywords: net.corda.core.flows.FinalityFlow class
Date: 2023-09-18

net.corda.core.flows

## Class FinalityFlow

- net.corda.core.flows.FlowLogic<T>
- - net.corda.core.flows.FinalityFlow

-     @InitiatingFlow
      public class FinalityFlow
      extends FlowLogic<T>

  Verifies the given transaction, then sends it to the named notary. If the notary agrees that the transaction is acceptable then it is from that point onwards committed to the ledger, and will be written through to the vault. Additionally it will be distributed to the parties reflected in the participants list of the states.

  By default, the initiating flow will commit states that are relevant to the initiating party as indicated by StatesToRecord.ONLY_RELEVANT. Relevance is determined by the union of all participants to states which have been included in the transaction. This default behaviour may be modified by passing in an alternate value for `enum StatesToRecord`.

  The transaction is expected to have already been resolved: if its dependencies are not available in local storage, verification will fail. It must have signatures from all necessary parties other than the notary.

  A list of `class FlowSession`s is required for each non-local participant of the transaction. These participants will receive the final notarised transaction by calling `class ReceiveFinalityFlow` in their counterpart flows. Sessions with non-participants can also be included, but they must specify StatesToRecord.ALL_VISIBLE for statesToRecord if they wish to record the contract states into their vaults.

  The flow returns the same transaction but with the additional signatures from the notary.

  NOTE: This is an inlined flow but for backwards compatibility is annotated with `annotationclass InitiatingFlow`.

  See Also:
    `enum StatesToRecord`, `class FlowSession`, `class ReceiveFinalityFlow`, `annotationclass InitiatingFlow`

- - ### Field Detail

    - #### Companion

          public static net.corda.core.flows.FinalityFlow.Companion Companion

  - ### Constructor Detail

    - #### FinalityFlow

          @Deprecated
          public FinalityFlow(@NotNull
                                          SignedTransaction transaction,
                                          @NotNull
                                          java.util.Set<net.corda.core.identity.Party> extraRecipients,
                                          @NotNull
                                          ProgressTracker progressTracker)

      Deprecated.

    - #### FinalityFlow

          @Deprecated
          public FinalityFlow(@NotNull
                                          SignedTransaction transaction,
                                          @NotNull
                                          java.util.Set<net.corda.core.identity.Party> extraRecipients)

      Deprecated.

    - #### FinalityFlow

          @Deprecated
          public FinalityFlow(@NotNull
                                          SignedTransaction transaction)

      Deprecated.

    - #### FinalityFlow

          @Deprecated
          public FinalityFlow(@NotNull
                                          SignedTransaction transaction,
                                          @NotNull
                                          ProgressTracker progressTracker)

      Deprecated.

    - #### FinalityFlow

          public FinalityFlow(@NotNull
                              SignedTransaction transaction,
                              @NotNull
                              FlowSession firstSession,
                              @NotNull
                              net.corda.core.flows.FlowSession... restSessions)

      Notarise the given transaction and broadcast it to the given `class FlowSession`s. This list must at least include all the non-local participants of the transaction. Sessions to non-participants can also be provided.

      Parameters:
        `transaction` - What to commit.
      See Also:
        `class FlowSession`

    - #### FinalityFlow

          @JvmOverloads
          public FinalityFlow(@NotNull
                                            SignedTransaction transaction,
                                            @NotNull
                                            java.util.Collection<? extends net.corda.core.flows.FlowSession> sessions,
                                            @NotNull
                                            ProgressTracker progressTracker)

      Notarise the given transaction and broadcast it to all the participants.

      Parameters:
        `transaction` - What to commit.
        `sessions` - A collection of `class FlowSession`s for each non-local participant of the transaction. Sessions to non-participants canalso be provided.

    - #### FinalityFlow

          @JvmOverloads
          public FinalityFlow(@NotNull
                                            SignedTransaction transaction,
                                            @NotNull
                                            java.util.Collection<? extends net.corda.core.flows.FlowSession> sessions)

      Notarise the given transaction and broadcast it to all the participants.

      Parameters:
        `transaction` - What to commit.
        `sessions` - A collection of `class FlowSession`s for each non-local participant of the transaction. Sessions to non-participants canalso be provided.

    - #### FinalityFlow

          @JvmOverloads
          public FinalityFlow(@NotNull
                                            SignedTransaction transaction,
                                            @NotNull
                                            java.util.Collection<? extends net.corda.core.flows.FlowSession> sessions,
                                            @NotNull
                                            StatesToRecord statesToRecord,
                                            @NotNull
                                            ProgressTracker progressTracker)

      Notarise the given transaction and broadcast it to all the participants.

      Parameters:
        `transaction` - What to commit.
        `sessions` - A collection of `class FlowSession`s for each non-local participant of the transaction. Sessions to non-participants canalso be provided.
        `statesToRecord` - Which states to commit to the vault.

    - #### FinalityFlow

          @JvmOverloads
          public FinalityFlow(@NotNull
                                            SignedTransaction transaction,
                                            @NotNull
                                            java.util.Collection<? extends net.corda.core.flows.FlowSession> sessions,
                                            @NotNull
                                            StatesToRecord statesToRecord)

      Notarise the given transaction and broadcast it to all the participants.

      Parameters:
        `transaction` - What to commit.
        `sessions` - A collection of `class FlowSession`s for each non-local participant of the transaction. Sessions to non-participants canalso be provided.
        `statesToRecord` - Which states to commit to the vault.

    - #### FinalityFlow

          @Deprecated
          public FinalityFlow(@NotNull
                                          SignedTransaction transaction,
                                          @NotNull
                                          java.util.Collection<? extends net.corda.core.flows.FlowSession> sessions,
                                          @NotNull
                                          java.util.Collection<net.corda.core.identity.Party> oldParticipants,
                                          @NotNull
                                          ProgressTracker progressTracker)

      Deprecated.

      Notarise the given transaction and broadcast it to all the participants.

      Parameters:
        `transaction` - What to commit.
        `sessions` - A collection of `class FlowSession`s for each non-local participant.
        `oldParticipants` -

        An optional collection of parties for participants who are still using the old API.

        You will only need to use this parameter if you have upgraded your CorDapp from the V3 FinalityFlow API but are required to provide backwards compatibility with participants running V3 nodes. If you're writing a new CorDapp then this does not apply and this parameter should be ignored.

  - ### Method Detail

    - #### getExtraConstructorArgs

          @CordaInternal
           @NotNull
          public net.corda.core.flows.FinalityFlow.ExtraConstructorArgs getExtraConstructorArgs()

    - #### call

          @Suspendable
           @NotNull
          public SignedTransaction call()

      This is where you fill out your business logic.

    - #### getTransaction

          @NotNull
          public SignedTransaction getTransaction()

    - #### getProgressTracker

          @NotNull
          public ProgressTracker getProgressTracker()

      Override this to provide a `class ProgressTracker`. If one is provided and stepped, the framework will do something helpful with the progress reports e.g record to the audit service. If this flow is invoked as a subflow of another, then the tracker will be made a child of the current step in the parent. If it's null, this flow doesn't track progress.

      Note that this has to return a tracker before the flow is invoked. You can't change your mind half way through.

      See Also:
        `class ProgressTracker`

    - #### tracker

          @JvmStatic
           @NotNull
          public static ProgressTracker tracker()