mirror of
https://github.com/corda/corda.git
synced 2025-04-07 11:27:01 +00:00
Helper SignedTransaction.buildFilteredTransaction(filtering) (#1394)
This commit is contained in:
parent
fef8a997f2
commit
39e44382be
@ -72,7 +72,7 @@ object NotaryFlow {
|
||||
val tx: Any = if (stx.isNotaryChangeTransaction()) {
|
||||
stx.notaryChangeTx
|
||||
} else {
|
||||
stx.tx.buildFilteredTransaction(Predicate { it is StateRef || it is TimeWindow })
|
||||
stx.buildFilteredTransaction(Predicate { it is StateRef || it is TimeWindow })
|
||||
}
|
||||
sendAndReceiveWithRetry(notaryParty, tx)
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import java.security.KeyPair
|
||||
import java.security.PublicKey
|
||||
import java.security.SignatureException
|
||||
import java.util.*
|
||||
import java.util.function.Predicate
|
||||
|
||||
/**
|
||||
* SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for
|
||||
@ -50,12 +51,18 @@ data class SignedTransaction(val txBits: SerializedBytes<CoreTransaction>,
|
||||
/** The id of the contained [WireTransaction]. */
|
||||
override val id: SecureHash get() = transaction.id
|
||||
|
||||
/** Returns the contained [WireTransaction], or throws if this is a notary change transaction */
|
||||
/** Returns the contained [WireTransaction], or throws if this is a notary change transaction. */
|
||||
val tx: WireTransaction get() = transaction as WireTransaction
|
||||
|
||||
/** Returns the contained [NotaryChangeWireTransaction], or throws if this is a normal transaction */
|
||||
/** Returns the contained [NotaryChangeWireTransaction], or throws if this is a normal transaction. */
|
||||
val notaryChangeTx: NotaryChangeWireTransaction get() = transaction as NotaryChangeWireTransaction
|
||||
|
||||
/**
|
||||
* Helper function to directly build a [FilteredTransaction] using provided filtering functions,
|
||||
* without first accessing the [WireTransaction] [tx].
|
||||
*/
|
||||
fun buildFilteredTransaction(filtering: Predicate<Any>) = tx.buildFilteredTransaction(filtering)
|
||||
|
||||
/** Helper to access the inputs of the contained transaction */
|
||||
val inputs: List<StateRef> get() = transaction.inputs
|
||||
/** Helper to access the notary of the contained transaction */
|
||||
|
@ -114,6 +114,10 @@ UNRELEASED
|
||||
``createSignature(filteredTransaction: FilteredTransaction, publicKey: PublicKey)`` and
|
||||
``createSignature(filteredTransaction: FilteredTransaction)`` to sign with the legal identity key.
|
||||
|
||||
* A new helper method ``buildFilteredTransaction(filtering: Predicate<Any>)`` is added to ``SignedTransaction`` to
|
||||
directly build a ``FilteredTransaction`` using provided filtering functions, without first accessing the
|
||||
``tx: WireTransaction``.
|
||||
|
||||
Milestone 14
|
||||
------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user