corda / net.corda.core.transactions / FilteredTransaction

FilteredTransaction

class FilteredTransaction : TraversableTransaction

Class representing merkleized filtered transaction.

Parameters

id - Merkle tree root hash.

filteredComponentGroups - list of transaction components groups remained after filters are applied to WireTransaction.

groupHashes - the roots of the transaction component groups.

Properties

filteredComponentGroups

val filteredComponentGroups: List<FilteredComponentGroup>

list of transaction components groups remained after filters are applied to WireTransaction.

groupHashes

val groupHashes: List<SecureHash>

the roots of the transaction component groups.

id

val id: SecureHash

Merkle tree root hash.

Inherited Properties

attachments

val attachments: List<SecureHash>

Hashes of the ZIP/JAR files that are needed to interpret the contents of this wire transaction.

availableComponentGroups

val availableComponentGroups: List<List<Any>>

Returns a list of all the component groups that are present in the transaction, excluding the privacySalt, in the following order (which is the same with the order in ComponentGroupEnum:

commands

val commands: List<Command<*>>

Ordered list of (CommandData, PublicKey) pairs that instruct the contracts what to do.

componentGroups

open val componentGroups: List<ComponentGroup>

inputs

open val inputs: List<StateRef>

Pointers to the input states on the ledger, identified by (tx identity hash, output index).

notary

open val notary: Party?

If present, the notary for this transaction. If absent then the transaction is not notarised at all. This is intended for issuance/genesis transactions that don't consume any other states and thus can't double spend anything.

outputs

open val outputs: List<TransactionState<ContractState>>

Ordered list of states defined by this transaction, along with the associated notaries.

timeWindow

val timeWindow: TimeWindow?

Functions

checkAllComponentsVisible

fun checkAllComponentsVisible(componentGroupEnum: ComponentGroupEnum): Unit

Function that checks if all of the components in a particular group are visible. This functionality is required on non-Validating Notaries to check that all inputs are visible. It might also be applied in Oracles or any other entity requiring Command visibility, but because this method cannot distinguish between related and unrelated to the signer Commands, one should use the checkCommandVisibility method, which is specifically designed for Command visibility purposes. The logic behind this algorithm is that we check that the root of the provided group partialMerkleTree matches with the root of a fullMerkleTree if computed using all visible components. Note that this method is usually called after or before verify, to also ensure that the provided partial Merkle tree corresponds to the correct leaf in the top Merkle tree.

checkCommandVisibility

fun checkCommandVisibility(publicKey: PublicKey): Unit

Function that checks if all of the commands that should be signed by the input public key are visible. This functionality is required from Oracles to check that all of the commands they should sign are visible. This algorithm uses the ComponentGroupEnum.SIGNERS_GROUP to count how many commands should be signed by the input PublicKey and it then matches it with the size of received commands. Note that this method does not throw if there are no commands for this key to sign in the original WireTransaction.

checkWithFun

fun checkWithFun(checkingFun: (Any) -> Boolean): Boolean

Function that checks the whole filtered structure. Force type checking on a structure that we obtained, so we don't sign more than expected. Example: Oracle is implemented to check only for commands, if it gets an attachment and doesn't expect it - it can sign over a transaction with the attachment that wasn't verified. Of course it depends on how you implement it, but else -> false should solve a problem with possible later extensions to WireTransaction.

verify

fun verify(): Unit

Runs verification of partial Merkle branch against id. Note that empty filtered transactions (with no component groups) are accepted as well, e.g. for Timestamp Authorities to blindly sign or any other similar case in the future that requires a blind signature over a transaction's id.

Companion Object Functions

buildFilteredTransaction

fun buildFilteredTransaction(wtx: WireTransaction, filtering: Predicate<Any>): FilteredTransaction

Construction of filtered transaction with partial Merkle tree.

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.