mock

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BTCRandom

type BTCRandom struct{}

func (*BTCRandom) GetCurrentChainTimeStamp

func (btc *BTCRandom) GetCurrentChainTimeStamp() (int64, error)

func (*BTCRandom) GetNonceByTimestamp

func (btc *BTCRandom) GetNonceByTimestamp(startTime time.Time, maxTime time.Duration, timestamp int64) (int, int64, int64, error)

func (*BTCRandom) GetTimeStampAndNonceByBlockHeight

func (btc *BTCRandom) GetTimeStampAndNonceByBlockHeight(blockHeight int) (int64, int64, error)

func (*BTCRandom) VerifyNonceWithTimestamp

func (btc *BTCRandom) VerifyNonceWithTimestamp(startTime time.Time, maxTime time.Duration, timestamp int64, nonce int64) (bool, error)

type BlockValidation

type BlockValidation interface {
	types.BlockInterface
}

type Consensus

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

func (*Consensus) ExtractBridgeValidationData

func (c *Consensus) ExtractBridgeValidationData(block types.BlockInterface) ([][]byte, []int, error)

func (*Consensus) ExtractPortalV4ValidationData

func (c *Consensus) ExtractPortalV4ValidationData(block types.BlockInterface) ([]*portalprocessv4.PortalSig, error)

func (*Consensus) GeValidators

func (c *Consensus) GeValidators() []*consensus.Validator

func (*Consensus) GetAllMiningPublicKeys

func (c *Consensus) GetAllMiningPublicKeys() []string

func (*Consensus) GetAllValidatorKeyState

func (c *Consensus) GetAllValidatorKeyState() map[string]consensus.MiningState

func (*Consensus) GetCurrentMiningPublicKey

func (c *Consensus) GetCurrentMiningPublicKey() (string, string)

func (*Consensus) GetOneValidator

func (c *Consensus) GetOneValidator() *consensus.Validator

func (*Consensus) GetOneValidatorForEachConsensusProcess

func (c *Consensus) GetOneValidatorForEachConsensusProcess() map[int]*consensus.Validator

func (*Consensus) GetUserRole

func (c *Consensus) GetUserRole() (string, string, int)

func (*Consensus) GetValidators

func (c *Consensus) GetValidators() []*consensus.Validator

func (*Consensus) IsCommitteeInChain

func (c *Consensus) IsCommitteeInChain(sid int) bool

func (*Consensus) IsCommitteeInShard

func (c *Consensus) IsCommitteeInShard(sid byte) bool

func (*Consensus) ValidateBlockCommitteSig

func (c *Consensus) ValidateBlockCommitteSig(block types.BlockInterface, committee []incognitokey.CommitteePublicKey, numFixNode int) error

func (*Consensus) ValidateProducerPosition

func (c *Consensus) ValidateProducerPosition(blk types.BlockInterface, lastProposerIdx int, committee []incognitokey.CommitteePublicKey, minCommitteeSize int, produceTimeSlot int64, proposeTimeSlot int64) error

func (*Consensus) ValidateProducerSig

func (c *Consensus) ValidateProducerSig(block types.BlockInterface, consensusType string) error

type ConsensusInterface

type ConsensusInterface interface {
	GetOneValidator() *consensus.Validator
	GetOneValidatorForEachConsensusProcess() map[int]*consensus.Validator
	ValidateProducerPosition(blk types.BlockInterface, lastProposerIdx int, committee []incognitokey.CommitteePublicKey, minCommitteeSize int) error
	ValidateProducerSig(block types.BlockInterface, consensusType string) error
	ValidateBlockCommitteSig(block types.BlockInterface, committee []incognitokey.CommitteePublicKey) error
	IsCommitteeInChain(int) bool
	GetValidators() []*consensus.Validator
}

type Fee

type Fee struct {
}

func (*Fee) RegisterBlock

func (f *Fee) RegisterBlock(block *types.ShardBlock) error

type Pubsub

type Pubsub struct{}

func (*Pubsub) PublishMessage

func (ps *Pubsub) PublishMessage(message *pubsub.Message)

type Server

type Server struct {
	BlockChain *blockchain.BlockChain
	TxPool     *mempool.TxPool
}

func (*Server) EnableMining

func (s *Server) EnableMining(enable bool) error

func (*Server) GetChainMiningStatus

func (s *Server) GetChainMiningStatus(chain int) string

func (*Server) GetIncognitoPublicKeyRole

func (s *Server) GetIncognitoPublicKeyRole(publicKey string) (int, bool, int)

func (*Server) GetMinerIncognitoPublickey

func (s *Server) GetMinerIncognitoPublickey(publicKey string, keyType string) []byte

func (*Server) GetNodeRole

func (s *Server) GetNodeRole() string

func (*Server) GetPublicKeyRole

func (s *Server) GetPublicKeyRole(publicKey string, keyType string) (int, int)

func (*Server) InsertNewShardView

func (s *Server) InsertNewShardView(state *blockchain.ShardBestState)

func (*Server) IsEnableMining

func (s *Server) IsEnableMining() bool

func (*Server) OnTx

func (s *Server) OnTx(p *peer.PeerConn, msg *wire.MessageTx)

func (*Server) OnTxPrivacyToken

func (s *Server) OnTxPrivacyToken(p *peer.PeerConn, msg *wire.MessageTxPrivacyToken)

func (*Server) PushBlockToAll

func (s *Server) PushBlockToAll(block types.BlockInterface, previousValidationData string, isBeacon bool) error

func (*Server) PushMessageToAll

func (s *Server) PushMessageToAll(message wire.Message) error

func (*Server) PushMessageToBeacon

func (s *Server) PushMessageToBeacon(msg wire.Message, exclusivePeerIDs map[libp2p.ID]bool) error

func (*Server) PushMessageToPeer

func (s *Server) PushMessageToPeer(message wire.Message, id peer2.ID) error

func (*Server) PushMessageToShard

func (s *Server) PushMessageToShard(message wire.Message, shardID byte) error

func (*Server) RequestMissingViewViaStream

func (s *Server) RequestMissingViewViaStream(peerID string, hashes [][]byte, fromCID int, chainName string) (err error)

type Syncker

type Syncker struct {
	Syncker *syncker.SynckerManager
}

func (*Syncker) GetCrossShardBlocksForShardProducer

func (s *Syncker) GetCrossShardBlocksForShardProducer(view *blockchain.ShardBestState, limit map[byte][]uint64) map[byte][]interface{}

func (*Syncker) GetCrossShardBlocksForShardValidator

func (s *Syncker) GetCrossShardBlocksForShardValidator(view *blockchain.ShardBestState, list map[byte][]uint64) (map[byte][]interface{}, error)

func (*Syncker) Init

func (s *Syncker) Init(config *syncker.SynckerManagerConfig)

func (*Syncker) InsertCrossShardBlock

func (s *Syncker) InsertCrossShardBlock(blk *types.CrossShardBlock)

func (*Syncker) SyncMissingBeaconBlock

func (s *Syncker) SyncMissingBeaconBlock(ctx context.Context, peerID string, fromHash common.Hash)

func (*Syncker) SyncMissingShardBlock

func (s *Syncker) SyncMissingShardBlock(ctx context.Context, peerID string, sid byte, fromHash common.Hash)

type TxPool

type TxPool struct {
	BlockChain *blockchain.BlockChain
}

func (*TxPool) Count

func (tp *TxPool) Count() int

func (*TxPool) EmptyPool

func (tp *TxPool) EmptyPool() bool

func (*TxPool) GetClonedPoolCandidate

func (tp *TxPool) GetClonedPoolCandidate() map[common.Hash]string

func (*TxPool) GetTx

func (tp *TxPool) GetTx(txHash *common.Hash) (metadata.Transaction, error)

func (*TxPool) HaveTransaction

func (tp *TxPool) HaveTransaction(hash *common.Hash) bool

func (*TxPool) ListTxs

func (tp *TxPool) ListTxs() []string

func (*TxPool) ListTxsDetail

func (tp *TxPool) ListTxsDetail() []metadata.Transaction

func (*TxPool) MarkForwardedTransaction

func (tp *TxPool) MarkForwardedTransaction(txHash common.Hash)

func (*TxPool) MaxFee

func (tp *TxPool) MaxFee() uint64

func (*TxPool) MaybeAcceptBatchTransactionForBlockProducing

func (tp *TxPool) MaybeAcceptBatchTransactionForBlockProducing(shardID byte, txs []metadata.Transaction, beaconHeight int64, shardView *blockchain.ShardBestState) ([]*metadata.TxDesc, error)

func (*TxPool) MaybeAcceptTransaction

func (tp *TxPool) MaybeAcceptTransaction(tx metadata.Transaction, beaconHeight int64) (*common.Hash, *mempool.TxDesc, error)

func (*TxPool) MaybeAcceptTransactionForBlockProducing

func (tp *TxPool) MaybeAcceptTransactionForBlockProducing(tx metadata.Transaction, beaconHeight int64, state *blockchain.ShardBestState) (*metadata.TxDesc, error)

func (*TxPool) RemoveCandidateList

func (tp *TxPool) RemoveCandidateList([]string)

func (*TxPool) RemoveTx

func (tp *TxPool) RemoveTx(txs []metadata.Transaction, isInBlock bool)

func (*TxPool) SendTransactionToBlockGen

func (tp *TxPool) SendTransactionToBlockGen()

func (*TxPool) Size

func (tp *TxPool) Size() uint64

func (*TxPool) TriggerCRemoveTxs

func (tp *TxPool) TriggerCRemoveTxs(tx metadata.Transaction)

func (*TxPool) ValidateSerialNumberHashH

func (tp *TxPool) ValidateSerialNumberHashH(serialNumber []byte) error

Jump to

Keyboard shortcuts

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