You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (st *BeaconState) Copy() *BeaconState {
// copy over state
stUn := *st
res := &stUn
// manually copy over slices
// validators
copy(res.validator_registry, st.validator_registry)
copy(res.validator_balances, st.validator_balances)
// randao
copy(res.latest_randao_mixes, st.latest_randao_mixes)
// recent state
copy(res.latest_crosslinks, st.latest_crosslinks)
copy(res.latest_block_roots, st.latest_block_roots)
copy(res.latest_active_index_roots, st.latest_active_index_roots)
copy(res.latest_slashed_balances, st.latest_slashed_balances)
copy(res.latest_attestations, st.latest_attestations)
copy(res.batched_block_roots, st.batched_block_roots)
// eth1
copy(res.eth1_data_votes, st.eth1_data_votes)
return res
}
Notice that (to be done with the new SSZ spec) many of these are not slices but arrays. Specifically latest_randao_mixes, latest_block_roots, latest_active_index_roots, latest_slashed_balances will all be arrays.
Surely there's a better way to do this :)
The text was updated successfully, but these errors were encountered:
latest_randao_mixes
,latest_block_roots
,latest_active_index_roots
,latest_slashed_balances
will all be arrays.The text was updated successfully, but these errors were encountered: