github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/executiondatasync/execution_data/util.go (about)

     1  package execution_data
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/onflow/flow-go/model/flow"
     7  	"github.com/onflow/flow-go/module/blobs"
     8  )
     9  
    10  // CalculateID calculates the root ID of the given execution data without storing any data.
    11  // No errors are expected during normal operation.
    12  func CalculateID(ctx context.Context, execData *BlockExecutionData, serializer Serializer) (flow.Identifier, error) {
    13  	executionDatastore := NewExecutionDataStore(blobs.NewNoopBlobstore(), serializer)
    14  
    15  	id, err := executionDatastore.Add(ctx, execData)
    16  	if err != nil {
    17  		return flow.ZeroID, err
    18  	}
    19  
    20  	return id, nil
    21  }