LinearPointer

class LinearPointer<T : LinearState>(val pointer: UniqueIdentifier, val type: Class<T>, val isResolved: Boolean = true) : StatePointer<T>

LinearPointer allows a ContractState to "point" to another LinearState creating a "many-to-one" relationship between all the states containing the pointer to a particular LinearState and the LinearState being pointed to. Using the LinearPointer is useful when one state depends on the data contained within another state that evolves independently. When using LinearPointer it is worth noting:

  • The node performing the resolution may not have seen any LinearStates with the specified linearId, as such the vault query in resolve will return null and resolve will throw an exception

  • The node performing the resolution may not have the latest version of the LinearState and therefore will return an older version of the LinearState. As the pointed-to state will be added as a reference state to the transaction then the transaction with such a reference state cannot be committed to the ledger until the most up-to-date version of the LinearState is available. See reference states documentation on docs.corda.net for more info.

Constructors

Link copied to clipboard
constructor(pointer: UniqueIdentifier, type: Class<T>)

Allows this class to be evolved through backwards compatibility with version 1 of this class.

constructor(pointer: UniqueIdentifier, type: Class<T>, isResolved: Boolean = true)

Properties

Link copied to clipboard
open override val isResolved: Boolean = true

Determines whether the state pointer should be resolved to a reference input when used in a transaction.

Link copied to clipboard
open override val pointer: UniqueIdentifier

An identifier for the ContractState that this StatePointer points to.

Link copied to clipboard
open override val type: Class<T>

Type of the state which is being pointed to.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun resolve(services: ServiceHub): StateAndRef<T>

Resolves a LinearPointer using the UniqueIdentifier contained in the pointer property. Returns a StateAndRef containing the latest version of the LinearState that the node calling resolve is aware of.

open override fun resolve(ltx: LedgerTransaction): StateAndRef<T>

Resolves a StatePointer to a StateAndRef from inside a LedgerTransaction. The intuition here is that all of the pointed-to states will be included in the transaction as reference states.