slashing

package
v0.0.0-...-3219c45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	ChainHead(context.Context) (*types.TipSet, error)
	ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error)
	StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error)
	StateReadState(context.Context, *types.Actor, types.TipSetKey) (*api.ActorState, error)
	ChainGetPath(context.Context, types.TipSetKey, types.TipSetKey) ([]*store.HeadChange, error)
	ChainGetGenesis(context.Context) (*types.TipSet, error)
	ChainGetTipSetByHeight(context.Context, uint64, types.TipSetKey) (*types.TipSet, error)
}

API provides an abstraction to a Filecoin full-node

type Index

type Index struct {
	TipSetKey string
	Miners    map[string]Slashes
}

Index contains slashing histoy information up-to a TipSetKey.

type Service

type Service struct {
	pb.UnimplementedAPIServer
	// contains filtered or unexported fields
}

Service implements the gprc service

func NewService

func NewService(si *SlashingIndex) *Service

NewService is a helper to create a new Service

func (*Service) Get

func (s *Service) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetReply, error)

Get calls slashing index Get

type Slashes

type Slashes struct {
	Epochs []uint64
}

Slashes contains a slice of distinct epochs for a miner

type SlashingIndex

type SlashingIndex struct {
	// contains filtered or unexported fields
}

SlashingIndex builds and provides slashing history of miners

func New

func New(ds datastore.TxnDatastore, api API) (*SlashingIndex, error)

New returns a new SlashingIndex. It will load previous state from ds, and immediatelly start getting in sync with new on-chain.

func (*SlashingIndex) Close

func (s *SlashingIndex) Close() error

Close closes the SlashindIndex

func (*SlashingIndex) Get

func (s *SlashingIndex) Get() Index

Get returns a copy of the current index information

func (*SlashingIndex) Listen

func (s *SlashingIndex) Listen() <-chan struct{}

Listen returns a a signaler channel which signals that index information has been updated.

func (*SlashingIndex) Unregister

func (s *SlashingIndex) Unregister(c chan struct{})

Unregister frees a channel from the signaler hub

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL