corda / net.corda.flows / FinalityFlow

# FinalityFlow

`class FinalityFlow : FlowLogic<List<SignedTransaction>>`

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

The transactions will be topologically sorted before commitment to ensure that dependencies are committed before dependers, so you don't need to do this yourself.

The transactions are expected to have already been resolved: if their dependencies are not available in local storage or within the given set, verification will fail. They must have signatures from all necessary parties other than the notary.

If specified, the extra recipients are sent all the given transactions. The base set of parties to inform of each transaction are calculated on a per transaction basis from the contract-given set of participants.

The flow returns the same transactions, in the same order, with the additional signatures.

### Parameters

`transactions` - What to commit.

`extraRecipients` - A list of additional participants to inform of the transaction.

### Types

BROADCASTING | `object BROADCASTING : Step`
NOTARISING | `object NOTARISING : Step`

### Constructors

<init> | `FinalityFlow(transaction: SignedTransaction, extraParticipants: Set<Party>)` `FinalityFlow(transaction: SignedTransaction)``FinalityFlow(transactions: Iterable<SignedTransaction>, extraRecipients: Set<Party>, progressTracker: ProgressTracker)` Verifies the given transactions, then sends them to the named notaries. If the notary agrees that the transactions are acceptable then they are from that point onwards committed to the ledger, and will be written through to the vault. Additionally they will be distributed to the parties reflected in the participants list of the states.

### Properties

extraRecipients | `val extraRecipients: Set<Party>`
progressTracker | `val progressTracker: ProgressTracker` Override this to provide a ProgressTracker. If one is provided and stepped, the framework will do something helpful with the progress reports. 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.
transactions | `val transactions: Iterable<SignedTransaction>`

### Inherited Properties

logger | `val logger: Logger` This is where you should log things to.
runId | `val runId: StateMachineRunId` Returns a wrapped UUID object that identifies this state machine run (i.e. subflows have the same identifier as their parents).
serviceHub | `val serviceHub: ServiceHub` Provides access to big, heavy classes that may be reconstructed from time to time, e.g. across restarts. It is only available once the flow has started, which means it cannnot be accessed in the constructor. Either access this lazily or from inside call.
stateMachine | `var stateMachine: FlowStateMachine<*>` Internal only. Reference to the Fiber instance that is the top level controller for the entire flow. When inside a flow this is equivalent to Strand.currentStrand. This is public only because it must be accessed across module boundaries.

### Functions

call | `fun call(): List<SignedTransaction>` This is where you fill out your business logic. The returned object will usually be ignored, but can be helpful if this flow is meant to be used as a subflow.

### Inherited Functions

getCounterpartyMarker | `open fun getCounterpartyMarker(party: Party): Class<*>` Return the marker Class which party has used to register the counterparty flow that is to execute on the other side. The default implementation returns the class object of this FlowLogic, but any Class instance will do as long as the other side registers with it.
receive | `open fun <R : Any> receive(receiveType: Class<R>, otherParty: Party): UntrustworthyData<R>` Suspends until the specified otherParty sends us a message of type receiveType. `fun <R : Any> receive(otherParty: Party): UntrustworthyData<R>` Suspends until the specified otherParty sends us a message of type R.
send | `open fun send(otherParty: Party, payload: Any): Unit` Queues the given payload for sending to the otherParty and continues without suspending.
sendAndReceive | `fun <R : Any> sendAndReceive(otherParty: Party, payload: Any): UntrustworthyData<R>` Serializes and queues the given payload object for sending to the otherParty. Suspends until a response is received, which must be of the given R type. `open fun <R : Any> sendAndReceive(receiveType: Class<R>, otherParty: Party, payload: Any): UntrustworthyData<R>` Serializes and queues the given payload object for sending to the otherParty. Suspends until a response is received, which must be of the given receiveType. Remember that when receiving data from other parties the data should not be trusted until it's been thoroughly verified for consistency and that all expectations are satisfied, as a malicious peer may send you subtly corrupted data in order to exploit your code.
subFlow | `open fun <R> subFlow(subLogic: FlowLogic<R>, shareParentSessions: Boolean = false): R` Invokes the given subflow. This function returns once the subflow completes successfully with the result returned by that subflows call method. If the subflow has a progress tracker, it is attached to the current step in this flow's progress tracker.
track | `fun track(): Pair<String, Observable<String>>?` Returns a pair of the current progress step, as a string, and an observable of stringified changes to the progressTracker.
waitForLedgerCommit | `fun waitForLedgerCommit(hash: SecureHash): SignedTransaction` Suspends the flow until the transaction with the specified ID is received, successfully verified and sent to the vault for processing. Note that this call suspends until the transaction is considered valid by the local node, but that doesn't imply the vault will consider it relevant.

### Companion Object Functions

tracker | `fun tracker(): ProgressTracker`