public class FilteredTransaction
extends TraversableTransaction
Class representing merkleized filtered transaction.
public static net.corda.core.transactions.FilteredTransaction.Companion Companion
public void verify()
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.
FilteredTransactionVerificationException
- if verification fails.public boolean checkWithFun(@NotNull kotlin.jvm.functions.Function1<java.lang.Object,java.lang.Boolean> checkingFun)
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.
checkingFun
- function that performs type checking on the structure fields and provides verification logic accordingly.public void checkAllComponentsVisible(@NotNull ComponentGroupEnum componentGroupEnum)
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 class Command
visibility, but because this method
cannot distinguish between related and unrelated to the signer class Command
s, one should use the
checkCommandVisibility
method, which is specifically designed for class 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.
componentGroupEnum
- the enum ComponentGroupEnum
that corresponds to the componentGroup for which we require full component visibility.ComponentVisibilityException
- if not all of the components are visible or if the component group is not present in the class FilteredTransaction
.class Command
,
class Command
,
checkCommandVisibility
,
class Command
,
verify
public void checkCommandVisibility(@NotNull java.security.PublicKey publicKey)
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 class WireTransaction
.
publicKey
- signer's PublicKeyComponentVisibilityException
- if not all of the related commands are visible.commands
,
class WireTransaction
@NotNull public SecureHash getId()
Merkle tree root hash.
@NotNull public java.util.List<net.corda.core.transactions.FilteredComponentGroup> getFilteredComponentGroups()
list of transaction components groups remained after filters are applied to
class WireTransaction
@NotNull public java.util.List<net.corda.core.crypto.SecureHash> getGroupHashes()
the roots of the transaction component groups.
@JvmStatic @NotNull public static FilteredTransaction buildFilteredTransaction(@NotNull WireTransaction wtx, @NotNull java.util.function.Predicate<java.lang.Object> filtering)
Construction of filtered transaction with partial Merkle tree.
wtx
- WireTransaction to be filtered.filtering
- filtering over the whole WireTransaction.