Minor: add field-level documentation to WireTransaction and TODO a few things that don't seem right.

This commit is contained in:
Mike Hearn 2016-09-06 13:35:54 +02:00
parent 8a19e6bbfb
commit f3fa54ebef

View File

@ -20,14 +20,42 @@ import java.security.PublicKey
* the identity of the transaction, that is, it's possible for two [SignedTransaction]s with different sets of * the identity of the transaction, that is, it's possible for two [SignedTransaction]s with different sets of
* signatures to have the same identity hash. * signatures to have the same identity hash.
*/ */
data class WireTransaction(val inputs: List<StateRef>, data class WireTransaction(
val attachments: List<SecureHash>, /** Pointers to the input states on the ledger, identified by (tx identity hash, output index). */
val outputs: List<TransactionState<ContractState>>, val inputs: List<StateRef>,
val commands: List<Command>, /** Hashes of the ZIP/JAR files that are needed to interpret the contents of this wire transaction. */
val notary: Party?, val attachments: List<SecureHash>,
val signers: List<PublicKey>, /** Ordered list of states defined by this transaction, along with the associated notaries. */
val type: TransactionType, val outputs: List<TransactionState<ContractState>>,
val timestamp: Timestamp?) : NamedByHash { /** Ordered list of ([CommandData], [PublicKey]) pairs that instruct the contracts what to do. */
val commands: List<Command>,
/**
* 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.
*
* TODO: Ensure the invariant 'notary == null -> inputs.isEmpty' is enforced!
*/
val notary: Party?,
/**
* Keys that are required to have signed the wrapping [SignedTransaction], ordered to match the list of
* signatures. There is nothing that forces the list to be the _correct_ list of signers for this
* transaction until the transaction is verified by using [LedgerTransaction.verify]. It includes the
* notary key, if the notary field is set.
*/
val signers: List<PublicKey>,
/**
* Pointer to a class that defines the behaviour of this transaction: either normal, or "notary changing".
*/
val type: TransactionType,
/**
* If specified, a time window in which this transaction may have been notarised. Contracts can check this
* time window to find out when a transaction is deemed to have occurred, from the ledger's perspective.
*
* TODO: Ensure the invariant 'timestamp != null -> notary != null' is enforced!
*/
val timestamp: Timestamp?
) : NamedByHash {
// Cache the serialised form of the transaction and its hash to give us fast access to it. // Cache the serialised form of the transaction and its hash to give us fast access to it.
@Volatile @Transient private var cachedBits: SerializedBytes<WireTransaction>? = null @Volatile @Transient private var cachedBits: SerializedBytes<WireTransaction>? = null