Skip to content

Commit 6452d6f

Browse files
committed
simplify node state aggregation by avoiding double destructuring
1 parent d437acc commit 6452d6f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hydra-node/src/Hydra/HeadLogic.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,9 +1438,9 @@ update env ledger NodeState{headState = st, pendingDeposits, currentSlot} ev = c
14381438

14391439
-- | Reflect 'StateChanged' events onto the 'NodeState' aggregateNodeState.
14401440
aggregateNodeState :: IsChainState tx => NodeState tx -> StateChanged tx -> NodeState tx
1441-
aggregateNodeState nodeState@NodeState{headState} sc =
1442-
let headState' = aggregate headState sc
1443-
ns@NodeState{headState = st, pendingDeposits} = nodeState{headState = headState'}
1441+
aggregateNodeState nodeState sc =
1442+
let st = aggregate (headState nodeState) sc
1443+
ns@NodeState{pendingDeposits} = nodeState{headState = st}
14441444
in case sc of
14451445
HeadOpened{chainState} ->
14461446
ns{pendingDeposits = mempty, currentSlot = chainStateSlot chainState}

0 commit comments

Comments
 (0)