public class FilteredTransaction
extends TraversableTransaction
Class representing merkleized filtered transaction.
Modifier and Type | Class and Description |
---|---|
static class |
FilteredTransaction.Companion |
Modifier and Type | Field and Description |
---|---|
static FilteredTransaction.Companion |
Companion |
Modifier and Type | Method and Description |
---|---|
void |
checkAllComponentsVisible(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
FilteredTransaction.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 FilteredTransaction.verify , to also ensure that the provided partial Merkle
tree corresponds to the correct leaf in the top Merkle tree. |
void |
checkCommandVisibility(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
TraversableTransaction.getCommands .
Note that this method does not throw if there are no commands for this key to sign in the original class WireTransaction . |
boolean |
checkWithFun(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.
|
java.util.List<net.corda.core.transactions.FilteredComponentGroup> |
getFilteredComponentGroups()
list of transaction components groups remained after filters are applied to
|
java.util.List<net.corda.core.crypto.SecureHash> |
getGroupHashes()
the roots of the transaction component groups.
|
SecureHash |
getId()
Merkle tree root hash.
|
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.
|
getAttachments, getAvailableComponentGroups, getCommands, getComponentGroups, getDigestService, getInputs, getNetworkParametersHash, getNotary, getOutputs, getReferences, getTimeWindow
getInputs, getNetworkParametersHash, getReferences
checkBaseInvariants, filterOutRefs, filterOutputs, findOutRef, findOutput, getInputs, getNotary, getOutput, getOutputStates, getOutputs, getReferences, outRef, outRef, outRefsOfType, outputsOfType, toString
getId
public static 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.
public boolean checkWithFun(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(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
FilteredTransaction.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 FilteredTransaction.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.class FilteredTransaction
.class Command
,
class Command
,
FilteredTransaction.checkCommandVisibility
,
class Command
,
FilteredTransaction.verify
public void checkCommandVisibility(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 TraversableTransaction.getCommands
.
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 PublicKeyTraversableTransaction.getCommands
,
class WireTransaction
public SecureHash getId()
Merkle tree root hash.
public java.util.List<net.corda.core.transactions.FilteredComponentGroup> getFilteredComponentGroups()
list of transaction components groups remained after filters are applied to
class WireTransaction
public java.util.List<net.corda.core.crypto.SecureHash> getGroupHashes()
the roots of the transaction component groups.