mpstore

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyMinerProof

func VerifyMinerProof(currencyID byte, addr string, minerKeyType byte, minerAddr string, proof []byte) error

VerifyMinerProof is used to verify the miner proof.

@input - currency id, addr (miner signed data), miner address, proof.

@output - error.

Types

type MinerProofStore

type MinerProofStore interface {
	// UpsertMinerProof is used to set the miner proof for a given currency id.
	//
	// @input - context, currency id, miner key type, miner address, proof.
	//
	// @output - error.
	UpsertMinerProof(ctx context.Context, currencyID byte, minerKeyType byte, minerAddr string, proof []byte) error

	// GetMinerProof is used to get the miner proof for a given currency id.
	//
	// @input - context, currency id.
	//
	// @output - if exists, miner key type, miner address, proof, error.
	GetMinerProof(ctx context.Context, currencyID byte) (bool, byte, string, []byte, error)
}

MinerProofStore is the interface for a store that stores linked miner's proof.

type MinerProofStoreImpl

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

MinerProofStoreImpl is the implementation of the MinerProofStore interface.

func NewMinerProofStoreImpl

func NewMinerProofStoreImpl(ctx context.Context, signer crypto.Signer, opts Opts) (*MinerProofStoreImpl, error)

NewMinerProofStoreImpl creates a new MinerProofStore.

@input - context, signer, options.

@output - miner proof store, error.

func (*MinerProofStoreImpl) GetMinerProof

func (s *MinerProofStoreImpl) GetMinerProof(ctx context.Context, currencyID byte) (bool, byte, string, []byte, error)

GetMinerProof is used to get the miner proof for a given currency id.

@input - context, currency id.

@output - if exists, miner key type, miner address, proof, error.

func (*MinerProofStoreImpl) Shutdown

func (s *MinerProofStoreImpl) Shutdown()

Shutdown safely shuts down the component.

func (*MinerProofStoreImpl) UpsertMinerProof

func (s *MinerProofStoreImpl) UpsertMinerProof(ctx context.Context, currencyID byte, minerKeyType byte, minerAddr string, proof []byte) error

UpsertMinerProof is used to set the miner proof for a given currency id.

@input - context, currency id, miner key type, miner address, proof.

@output - error.

type Opts

type Opts struct {
	// The datastore path of the miner proof store.
	Path string
}

Opts is the options for miner proof store.

Jump to

Keyboard shortcuts

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