Skip to content

Commit

Permalink
Add HasChainwebVersion and ChainId instances for NewBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
larskuhtz committed Dec 24, 2024
1 parent ad836d4 commit c559dbe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Chainweb/WebPactExecutionService.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,19 @@ newBlockParent (NewBlockInProgress (ForSomePactVersion _ bip)) = blockInProgress
newBlockParent (NewBlockPayload (ParentHeader ph) _) =
(view blockHash ph, view blockHeight ph, view blockCreationTime ph)

instance HasChainwebVersion NewBlock where
_chainwebVersion (NewBlockInProgress (ForSomePactVersion _ bip)) = _chainwebVersion bip
_chainwebVersion (NewBlockPayload ph _) = _chainwebVersion ph

instance HasChainId NewBlock where
_chainId (NewBlockInProgress (ForSomePactVersion _ bip)) = _chainId bip
_chainId (NewBlockPayload ph _) = _chainId ph

newBlockToNewPayload :: NewBlock -> NewPayload
newBlockToNewPayload nb = NewPayload
{ _newPayloadParentHeight = height
{ _newPayloadChainwebVersion = _chainwebVersion nb
, _newPayloadChainId = _chainId nb
, _newPayloadParentHeight = height
, _newPayloadParentHash = h
, _newPayloadBlockPayloadHash = _payloadWithOutputsPayloadHash pwo
, _newPayloadEncodedPayloadData = Just epd
Expand Down

0 comments on commit c559dbe

Please sign in to comment.