server

package
v0.0.0-...-f30a169 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package server is SPV module

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SPV

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

SPV is a spv instance for a specific remote chain

func NewSPV

func NewSPV(chain *conf.ChainConfig, store storage.StateDB, log *zap.SugaredLogger) (*SPV, error)

NewSPV creates a spv for a specific remote chain

func (*SPV) GetAdapter

func (s *SPV) GetAdapter() adapter.SDKAdapter

GetAdapter gets adapter

func (*SPV) GetCoder

func (s *SPV) GetCoder() coder.Coder

GetCoder gets coder

func (*SPV) GetProver

func (s *SPV) GetProver() prover.Prover

GetProver gets prover

func (*SPV) GetStateDB

func (s *SPV) GetStateDB() storage.StateDB

GetStateDB gets stateDB

func (*SPV) GetStateManager

func (s *SPV) GetStateManager() *manager.StateManager

GetStateManager gets state manager

func (*SPV) GetVerifier

func (s *SPV) GetVerifier() verifier.Verifier

GetVerifier gets verifier

func (*SPV) Start

func (s *SPV) Start() error

Start startups a spv instance

func (*SPV) Stop

func (s *SPV) Stop() error

Stop stops a spv instance

type SPVServer

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

SPVServer contains all chains' SPV

func IntSPVServer

func IntSPVServer() (*SPVServer, error)

IntSPVServer inits spv server when deployed independently

func NewSPVServer

func NewSPVServer(ymFile string, log *zap.SugaredLogger) (*SPVServer, error)

NewSPVServer inits spv config and creates spv server when integrated as a component

func (*SPVServer) ForwardRequest

func (ss *SPVServer) ForwardRequest(request *cm_pbgo.TxRequest) (*cm_pbgo.TxResponse, error)

func (*SPVServer) GetAdapter

func (ss *SPVServer) GetAdapter(chainId string) (adapter.SDKAdapter, error)

GetAdapter gets the sdk adapter of spv by chain id

func (*SPVServer) GetCoder

func (ss *SPVServer) GetCoder(chainId string) (coder.Coder, error)

GetCoder gets the coder of spv by chain id

func (*SPVServer) GetDB

func (ss *SPVServer) GetDB() storage.StateDB

GetDB gets the db of spvServer

func (*SPVServer) RegisterCallBack

func (ss *SPVServer) RegisterCallBack(chainId string, callBack manager.CallBack) error

RegisterCallBack registers CallBack

func (*SPVServer) SetLog

func (ss *SPVServer) SetLog(log *zap.SugaredLogger) error

SetLog sets log for unit test

func (*SPVServer) Start

func (ss *SPVServer) Start() error

Start startups all chains' spv

func (*SPVServer) Stop

func (ss *SPVServer) Stop() error

Stop stops all chains' spv

func (*SPVServer) ValidTransaction

func (ss *SPVServer) ValidTransaction(info *api.TxValidationInfo, timeout time.Duration) error

ValidTransaction verifies the existence and validity of the transaction

Jump to

Keyboard shortcuts

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