Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype SnapshotNumber = UnsafeSnapshotNumber Natural
- fromChainSnapshotNumber :: SnapshotNumber -> SnapshotNumber
- newtype SnapshotVersion = UnsafeSnapshotVersion Natural
- fromChainSnapshotVersion :: SnapshotVersion -> SnapshotVersion
- data Snapshot tx = Snapshot {
- headId :: HeadId
- version :: SnapshotVersion
- number :: SnapshotNumber
- confirmed :: [tx]
- utxo :: UTxOType tx
- utxoToCommit :: Maybe (UTxOType tx)
- utxoToDecommit :: Maybe (UTxOType tx)
- data ConfirmedSnapshot tx
- = InitialSnapshot {
- headId :: HeadId
- initialUTxO :: UTxOType tx
- | ConfirmedSnapshot {
- snapshot :: Snapshot tx
- signatures :: MultiSignature (Snapshot tx)
- = InitialSnapshot {
- getSnapshot :: ConfirmedSnapshot tx -> Snapshot tx
- genConfirmedSnapshot :: IsTx tx => HeadId -> SnapshotVersion -> SnapshotNumber -> UTxOType tx -> Maybe (UTxOType tx) -> Maybe (UTxOType tx) -> [SigningKey HydraKey] -> Gen (ConfirmedSnapshot tx)
SnapshotNumber and SnapshotVersion
newtype SnapshotNumber Source #
Instances
fromChainSnapshotNumber :: SnapshotNumber -> SnapshotNumber Source #
newtype SnapshotVersion Source #
Instances
fromChainSnapshotVersion :: SnapshotVersion -> SnapshotVersion Source #
Snapshot
Snapshot | |
|
Instances
ConfirmedSnapshot
data ConfirmedSnapshot tx Source #
A snapshot that can be used to close a head with. Either the initial one, or when it was signed by all parties, i.e. it is confirmed.
InitialSnapshot | |
| |
ConfirmedSnapshot | |
|
Instances
getSnapshot :: ConfirmedSnapshot tx -> Snapshot tx Source #
Safely get a Snapshot
from a confirmed snapshot.
NOTE: While we could use $sel:snapshot:InitialSnapshot
directly, this is a record-field accessor
which may become partial (and lead to unnoticed runtime errors) if we ever
add a new branch to the sumtype. So, we explicitely define a getter which
will force us into thinking about changing the signature properly if this
happens.
:: IsTx tx | |
=> HeadId | |
-> SnapshotVersion | Exact snapshot version to generate. |
-> SnapshotNumber | The lower bound on snapshot number to generate.
If this is 0, then we can generate an |
-> UTxOType tx | |
-> Maybe (UTxOType tx) | |
-> Maybe (UTxOType tx) | |
-> [SigningKey HydraKey] | |
-> Gen (ConfirmedSnapshot tx) |