mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
37bc407b56
* initial changes * gaz * unexport and add in godoc * nocache * fix edge case * fix bad implementation * fix build file * add it in * terence's review * gaz * fix build * Apply suggestions from code review remove assigned ctx Co-authored-by: terence tsao <terence@prysmaticlabs.com>
19 lines
625 B
Go
19 lines
625 B
Go
package v1
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
|
"github.com/prysmaticlabs/prysm/config/features"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
)
|
|
|
|
// computeFieldRoots returns the hash tree root computations of every field in
|
|
// the beacon state as a list of 32 byte roots.
|
|
func computeFieldRoots(ctx context.Context, state *ethpb.BeaconState) ([][]byte, error) {
|
|
if features.Get().EnableSSZCache {
|
|
return stateutil.CachedHasher.ComputeFieldRootsWithHasherPhase0(ctx, state)
|
|
}
|
|
return stateutil.NocachedHasher.ComputeFieldRootsWithHasherPhase0(ctx, state)
|
|
}
|