hydra-tx
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Tx.Close

Synopsis

Construction

type PointInTime = (SlotNo, UTCTime) Source #

data OpenThreadOutput Source #

Representation of the head thread UTxO while the head is in the Open state.

Constructors

OpenThreadOutput 

Fields

Instances

Instances details
Generic OpenThreadOutput Source # 
Instance details

Defined in Hydra.Tx.Close

Associated Types

type Rep OpenThreadOutput :: Type -> Type Source #

Show OpenThreadOutput Source # 
Instance details

Defined in Hydra.Tx.Close

Eq OpenThreadOutput Source # 
Instance details

Defined in Hydra.Tx.Close

type Rep OpenThreadOutput Source # 
Instance details

Defined in Hydra.Tx.Close

type Rep OpenThreadOutput = D1 ('MetaData "OpenThreadOutput" "Hydra.Tx.Close" "hydra-tx-2.4.1-6u9wd83eS2xF3WS9TuJN93" 'False) (C1 ('MetaCons "OpenThreadOutput" 'PrefixI 'True) ((S1 ('MetaSel ('Just "openThreadUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: S1 ('MetaSel ('Just "openContestationPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContestationPeriod)) :*: (S1 ('MetaSel ('Just "openDepositPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DepositPeriod) :*: S1 ('MetaSel ('Just "openParties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Party]))))

isClosableAt :: SnapshotVersion -> Snapshot tx -> Bool Source #

Whether a head at the given open version can be closed with the snapshot, such that the closed head can later be fanned out.

The head validator only accepts a snapshot signed at the open version (CloseInitial, CloseAny, CloseUnused) or one before (CloseUsed). The latter stores the snapshot's applied accumulator, which only matches the head value if the version bump was this snapshot's own increment or decrement. For a snapshot without a pending action the version moved on through another snapshot's settlement, so the closed head could never be fanned out: a later snapshot this node has not adopted, or an earlier commit this snapshot dropped once its increment could no longer land, which landed after all. A settling decommit is never dropped (the snapshot request handler requires every request at its version to carry it), so a confirmed snapshot never lags the head by a decommit it already accounts for.

closeTx Source #

Arguments

:: ScriptRegistry

Published Hydra scripts to reference.

-> VerificationKey PaymentKey

Party who's authorizing this transaction

-> HeadId

Head identifier

-> SnapshotVersion

Last known version of the open head.

-> ConfirmedSnapshot Tx

Snapshot with instructions how to close the head.

-> SlotNo

Lower validity slot number, usually a current or quite recent slot number.

-> PointInTime

Upper validity slot and UTC time to compute the contestation deadline time.

-> OpenThreadOutput

Everything needed to spend the Head state-machine output.

-> IncrementalAction 
-> Tx 

Create a transaction closing a head with either the initial snapshot or with a multi-signed confirmed snapshot.

Observation

data CloseObservation Source #

Constructors

CloseObservation 

Fields

Instances

Instances details
FromJSON CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

ToJSON CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

Generic CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

Associated Types

type Rep CloseObservation :: Type -> Type Source #

Show CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

Eq CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

type Rep CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

type Rep CloseObservation = D1 ('MetaData "CloseObservation" "Hydra.Tx.Close" "hydra-tx-2.4.1-6u9wd83eS2xF3WS9TuJN93" 'False) (C1 ('MetaCons "CloseObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotNumber)) :*: (S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "signatures") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MultiSignature (Snapshot Tx))))))

observeCloseTx Source #

Arguments

:: UTxO

A UTxO set to lookup tx inputs

-> Tx 
-> Maybe CloseObservation 

Identify a close tx by lookup up the input spending the Head output and decoding its redeemer.