github.com/lazyledger/lazyledger-core@v0.35.0-dev.0.20210613111200-4c651f053571/light/provider/provider.go (about)

     1  package provider
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/lazyledger/lazyledger-core/types"
     7  )
     8  
     9  // Provider provides information for the light client to sync (verification
    10  // happens in the client).
    11  type Provider interface {
    12  	// LightBlock returns the LightBlock that corresponds to the given
    13  	// height.
    14  	//
    15  	// 0 - the latest.
    16  	// height must be >= 0.
    17  	//
    18  	// If the provider fails to fetch the LightBlock due to the IO or other
    19  	// issues, an error will be returned.
    20  	// If there's no LightBlock for the given height, ErrLightBlockNotFound
    21  	// error is returned.
    22  	LightBlock(ctx context.Context, height int64) (*types.LightBlock, error)
    23  
    24  	// DASLightBlock returns the LightBlock containing the DataAvailabilityHeader.
    25  	// Other than including the DataAvailabilityHeader it behaves exactly the same
    26  	// as LightBlock.
    27  	//
    28  	// It can be used by DAS light clients.
    29  	DASLightBlock(ctx context.Context, height int64) (*types.LightBlock, error)
    30  
    31  	// ReportEvidence reports an evidence of misbehavior.
    32  	ReportEvidence(context.Context, types.Evidence) error
    33  }