@@ -597,12 +597,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Accessors do
597597 |> Enum . reduce_while ( { MapSet . new ( ) , 0 } , fn committee_index , { attesters , offset } ->
598598 case get_beacon_committee ( state , data . slot , committee_index ) do
599599 { :ok , committee } ->
600- committee_attesters =
601- committee
602- |> Stream . with_index ( offset )
603- |> Stream . filter ( fn { _validator , pos } -> participated? ( aggregation_bits , pos ) end )
604- |> Stream . map ( fn { validator , _ } -> validator end )
605- |> MapSet . new ( )
600+ committee_attesters = compute_committee_attesters ( committee , aggregation_bits , offset )
606601
607602 { :cont , { MapSet . union ( attesters , committee_attesters ) , offset + length ( committee ) } }
608603
@@ -616,6 +611,14 @@ defmodule LambdaEthereumConsensus.StateTransition.Accessors do
616611 end
617612 end
618613
614+ defp compute_committee_attesters ( committee , aggregation_bits , offset ) do
615+ committee
616+ |> Stream . with_index ( offset )
617+ |> Stream . filter ( fn { _validator , pos } -> participated? ( aggregation_bits , pos ) end )
618+ |> Stream . map ( fn { validator , _ } -> validator end )
619+ |> MapSet . new ( )
620+ end
621+
619622 @ spec get_committee_attesting_indices ( [ Types . validator_index ( ) ] , Types . bitlist ( ) ) ::
620623 [ Types . validator_index ( ) ]
621624 def get_committee_attesting_indices ( committee , bits ) do
0 commit comments