mainBlockContext :: (NodeConstraints, MonadIO m, MonadCatch m)
                 => GenesisHash -> Core.MainBlock -> WithNodeState m BlockContext
mainBlockContext genesisHash mb = do
    mPrev <- view strict <$>
        mostRecentMainBlock genesisHash (mb ^. Core.mainBlockPrevBlock)
    return BlockContext {
        _bcSlotId   = InDb $ mb ^. Core.mainBlockSlot
      , _bcHash     = InDb $ Core.headerHash mb
      , _bcPrevMain = (InDb . Core.headerHash) <$> mPrev
      }

{-------------------------------------------------------------------------------
  Pretty-printing
-------------------------------------------------------------------------------}
mainBlockContext :: (NodeConstraints, MonadIO m, MonadCatch m)
                 => GenesisHash -> Core.MainBlock -> WithNodeState m BlockContext
mainBlockContext genesisHash mb = do
    mPrev <- view strict <$>
        mostRecentMainBlock genesisHash (mb ^. Core.mainBlockPrevBlock)
    return BlockContext {
        _bcSlotId   = InDb $ mb ^. Core.mainBlockSlot
      , _bcHash     = InDb $ Core.headerHash mb
      , _bcPrevMain = (InDb . Core.headerHash) <$> mPrev
      }

{-------------------------------------------------------------------------------
  Pretty-printing
-------------------------------------------------------------------------------}
mainBlockContext genesisHash mb = do
    mPrev <- view strict <$>
        mostRecentMainBlock genesisHash (mb ^. Core.mainBlockPrevBlock)
    return BlockContext {
        _bcSlotId   = InDb $ mb ^. Core.mainBlockSlot
      , _bcHash     = InDb $ Core.headerHash mb
      , _bcPrevMain = (InDb . Core.headerHash) <$> mPrev
      }

{-------------------------------------------------------------------------------
  Pretty-printing
-------------------------------------------------------------------------------}