Skip to content

Commit

Permalink
OnDepositTx head logic changes
Browse files Browse the repository at this point in the history
Signed-off-by: Sasha Bogicevic <[email protected]>
  • Loading branch information
v0d1ch committed Sep 10, 2024
1 parent 44d56c0 commit 3eb0340
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hydra-node/src/Hydra/HeadLogic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,13 @@ onOpenNetworkReqDec env ledger ttl openState decommitTx =
, currentSlot
} = openState

onOpenChainDepositTx ::
IsTx tx =>
OpenState tx ->
UTxOType tx ->
Outcome tx
onOpenChainDepositTx openState utxo = undefined

-- | Observe a decrement transaction. If the outputs match the ones of the
-- pending decommit tx, then we consider the decommit finalized, and remove the
-- decommit tx in flight.
Expand Down Expand Up @@ -1128,6 +1135,8 @@ update env ledger st ev = case (st, ev) of
onOpenClientDecommit headId ledger currentSlot coordinatedHeadState decommitTx
(Open openState, NetworkInput ttl (ReceivedMessage{msg = ReqDec{transaction}})) ->
onOpenNetworkReqDec env ledger ttl openState transaction
(Open openState@OpenState{headId = ourHeadId}, ChainInput Observation{observedTx = OnDepositTx{headId, utxo}})
| ourHeadId == headId -> onOpenChainDepositTx openState utxo
(Open openState@OpenState{headId = ourHeadId}, ChainInput Observation{observedTx = OnDecrementTx{headId, newVersion, distributedOutputs}})
-- TODO: What happens if observed decrement tx get's rolled back?
| ourHeadId == headId ->
Expand Down

0 comments on commit 3eb0340

Please sign in to comment.