Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigTst() mesh.Config
- func NewAtxQueue(s *Syncer, fetchPoetProof FetchPoetProofFunc) *atxQueue
- func NewFetchWorker(s WorkerInfra, count int, reqFactory BatchRequestFactory, ...) worker
- func NewNeighborhoodWorker(s WorkerInfra, count int, reqFactory RequestFactory) worker
- func NewPeersWorker(s WorkerInfra, peers []p2p.Peer, mu *sync.Once, reqFactory RequestFactory) worker
- func NewTxQueue(s *Syncer) *txQueue
- func NewValidationQueue(srvr WorkerInfra, conf Configuration, msh ValidationInfra, ...) *blockQueue
- type AtxMemPool
- type BatchRequestFactory
- type BlockEligibilityValidator
- type BlockEligibilityValidatorMock
- type BlockListener
- type CheckLocalFunc
- type Configuration
- type FetchPoetProofFunc
- type ForBlockInView
- type Item
- type LayerValidator
- type MeshValidatorMock
- func (mlg *MeshValidatorMock) ContextualValidity(id types.BlockID) bool
- func (m *MeshValidatorMock) GetGoodPatternBlocks(layer types.LayerID) (map[types.BlockID]struct{}, error)
- func (m *MeshValidatorMock) HandleIncomingLayer(lyr *types.Layer) (types.LayerID, types.LayerID)
- func (m *MeshValidatorMock) HandleLateBlock(bl *types.Block) (types.LayerID, types.LayerID)
- func (m *MeshValidatorMock) LatestComplete() types.LayerID
- func (m *MeshValidatorMock) PersistTortoise() error
- func (m *MeshValidatorMock) RegisterLayerCallback(func(id types.LayerID))
- type MockAtxMemPool
- type MockClock
- type MockIStore
- type MockState
- func (MockState) AddressExists(addr types.Address) bool
- func (MockState) ApplyRewards(layer types.LayerID, miners []types.Address, reward *big.Int)
- func (MockState) ApplyTransactions(layer types.LayerID, txs []*types.Transaction) (int, error)
- func (MockState) GetLayerApplied(txId types.TransactionId) *types.LayerID
- func (s MockState) GetStateRoot() types.Hash32
- func (s MockState) LoadState(layer types.LayerID) error
- func (MockState) ValidateNonceAndBalance(transaction *types.Transaction) error
- func (MockState) ValidateSignature(signed types.Signed) (types.Address, error)
- type MockTxMemPool
- type Peers
- type PoetDb
- type PoetDbMock
- func (*PoetDbMock) GetMembershipMap(poetRoot []byte) (map[types.Hash32]bool, error)
- func (PoetDbMock) GetProofMessage(proofRef []byte) ([]byte, error)
- func (PoetDbMock) HasProof(proofRef []byte) bool
- func (*PoetDbMock) SubscribeToProofRef(poetId []byte, roundId string) chan []byte
- func (PoetDbMock) ValidateAndStore(proofMessage *types.PoetProofMessage) error
- type RequestFactory
- type SValidateAtxFunc
- type StateMock
- type Status
- type Syncer
- func (s *Syncer) Await() chan struct{}
- func (s *Syncer) Close()
- func (s *Syncer) DataAvailability(blk *types.Block) ([]*types.Transaction, []*types.ActivationTx, error)
- func (s *Syncer) FetchPoetProof(poetProofRef []byte) error
- func (s *Syncer) ForceSync()
- func (s *Syncer) GetAndValidateLayer(id types.LayerID) error
- func (ms Syncer) GetExit() chan struct{}
- func (ms Syncer) GetTimeout() time.Duration
- func (s *Syncer) IsSynced() bool
- func (s *Syncer) ListenToGossip() bool
- func (s *Syncer) Start()
- func (s *Syncer) Status() string
- func (s *Syncer) ValidatingLayer() types.LayerID
- type SyntacticValidatorMock
- type TickProvider
- type TxMemPool
- type ValidationInfra
- type ValidatorMock
- type WorkerInfra
Constants ¶
View Source
const ( Namespace = "spacemesh" Subsystem = "consensus" )
View Source
const ( Pending Status = 0 InProgress Status = 1 Done Status = 2 BLOCK server.MessageType = 1 LAYER_HASH server.MessageType = 2 LAYER_IDS server.MessageType = 3 TX server.MessageType = 4 ATX server.MessageType = 5 POET server.MessageType = 6 SyncedTxt = "Node is Synced" OutOfSyncTxt = "Node is out of Sync" ValidatingLayerNone types.LayerID = 0 )
Variables ¶
View Source
var ( BlockFetchReqFactory = newFetchReqFactory(BLOCK, blocksAsItems) TxFetchReqFactory = newFetchReqFactory(TX, txsAsItems) AtxFetchReqFactory = newFetchReqFactory(ATX, atxsAsItems) )
Functions ¶
func NewAtxQueue ¶
func NewAtxQueue(s *Syncer, fetchPoetProof FetchPoetProofFunc) *atxQueue
func NewFetchWorker ¶
func NewFetchWorker(s WorkerInfra, count int, reqFactory BatchRequestFactory, idsChan chan []types.Hash32, name string) worker
func NewNeighborhoodWorker ¶
func NewNeighborhoodWorker(s WorkerInfra, count int, reqFactory RequestFactory) worker
func NewPeersWorker ¶
func NewPeersWorker(s WorkerInfra, peers []p2p.Peer, mu *sync.Once, reqFactory RequestFactory) worker
func NewTxQueue ¶
func NewTxQueue(s *Syncer) *txQueue
func NewValidationQueue ¶
func NewValidationQueue(srvr WorkerInfra, conf Configuration, msh ValidationInfra, checkLocal CheckLocalFunc, lg log.Log) *blockQueue
Types ¶
type AtxMemPool ¶
type AtxMemPool interface { Get(id types.AtxId) (*types.ActivationTx, error) Put(atx *types.ActivationTx) }
type BatchRequestFactory ¶
type BlockEligibilityValidator ¶ added in v0.1.2
type BlockEligibilityValidatorMock ¶
type BlockEligibilityValidatorMock struct { }
func (BlockEligibilityValidatorMock) BlockSignedAndEligible ¶
func (BlockEligibilityValidatorMock) BlockSignedAndEligible(block *types.Block) (bool, error)
type BlockListener ¶
type BlockListener struct { *Syncer BlockEligibilityValidator log.Log // contains filtered or unexported fields }
func NewBlockListener ¶
func (*BlockListener) Close ¶
func (bl *BlockListener) Close()
func (BlockListener) GetTimeout ¶
func (*BlockListener) ListenToGossipBlocks ¶
func (bl *BlockListener) ListenToGossipBlocks()
func (*BlockListener) Start ¶
func (bl *BlockListener) Start()
type CheckLocalFunc ¶
type Configuration ¶
type FetchPoetProofFunc ¶
type ForBlockInView ¶
type LayerValidator ¶
type MeshValidatorMock ¶
type MeshValidatorMock struct {
// contains filtered or unexported fields
}
func (*MeshValidatorMock) ContextualValidity ¶
func (mlg *MeshValidatorMock) ContextualValidity(id types.BlockID) bool
func (*MeshValidatorMock) GetGoodPatternBlocks ¶
func (*MeshValidatorMock) HandleIncomingLayer ¶
func (*MeshValidatorMock) HandleLateBlock ¶
func (*MeshValidatorMock) LatestComplete ¶
func (m *MeshValidatorMock) LatestComplete() types.LayerID
func (*MeshValidatorMock) PersistTortoise ¶
func (m *MeshValidatorMock) PersistTortoise() error
func (*MeshValidatorMock) RegisterLayerCallback ¶
func (m *MeshValidatorMock) RegisterLayerCallback(func(id types.LayerID))
type MockAtxMemPool ¶
type MockAtxMemPool struct{}
func (MockAtxMemPool) Get ¶
func (MockAtxMemPool) Get(id types.AtxId) (*types.ActivationTx, error)
func (MockAtxMemPool) GetAllItems ¶
func (MockAtxMemPool) GetAllItems() []types.ActivationTx
func (MockAtxMemPool) Invalidate ¶
func (MockAtxMemPool) Invalidate(id types.AtxId)
func (MockAtxMemPool) Put ¶
func (MockAtxMemPool) Put(atx *types.ActivationTx)
type MockClock ¶
type MockClock struct { Interval duration.Duration Layer types.LayerID // contains filtered or unexported fields }
func (*MockClock) GetCurrentLayer ¶
func (*MockClock) Subscribe ¶
func (c *MockClock) Subscribe() timesync.LayerTimer
func (*MockClock) Unsubscribe ¶
func (c *MockClock) Unsubscribe(timer timesync.LayerTimer)
type MockIStore ¶
type MockIStore struct { }
func (*MockIStore) GetIdentity ¶
func (*MockIStore) GetIdentity(id string) (types.NodeId, error)
func (*MockIStore) StoreNodeIdentity ¶
func (*MockIStore) StoreNodeIdentity(id types.NodeId) error
type MockState ¶
type MockState struct{}
func (MockState) ApplyRewards ¶
func (MockState) ApplyTransactions ¶
func (MockState) GetLayerApplied ¶
func (MockState) GetLayerApplied(txId types.TransactionId) *types.LayerID
func (MockState) GetStateRoot ¶
func (MockState) ValidateNonceAndBalance ¶
func (MockState) ValidateNonceAndBalance(transaction *types.Transaction) error
type MockTxMemPool ¶
type MockTxMemPool struct{}
func (MockTxMemPool) Get ¶
func (MockTxMemPool) Get(id types.TransactionId) (*types.Transaction, error)
func (MockTxMemPool) GetAllItems ¶
func (MockTxMemPool) GetAllItems() []*types.Transaction
func (MockTxMemPool) Invalidate ¶
func (MockTxMemPool) Invalidate(id types.TransactionId)
func (MockTxMemPool) Put ¶
func (MockTxMemPool) Put(id types.TransactionId, item *types.Transaction)
type PoetDbMock ¶
type PoetDbMock struct{}
func (*PoetDbMock) GetMembershipMap ¶
func (PoetDbMock) GetProofMessage ¶
func (PoetDbMock) GetProofMessage(proofRef []byte) ([]byte, error)
func (PoetDbMock) HasProof ¶
func (PoetDbMock) HasProof(proofRef []byte) bool
func (*PoetDbMock) SubscribeToProofRef ¶
func (*PoetDbMock) SubscribeToProofRef(poetId []byte, roundId string) chan []byte
func (PoetDbMock) ValidateAndStore ¶
func (PoetDbMock) ValidateAndStore(proofMessage *types.PoetProofMessage) error
type RequestFactory ¶
type RequestFactory func(s WorkerInfra, peer p2p.Peer) (chan interface{}, error)
func HashReqFactory ¶
func HashReqFactory(lyr types.LayerID) RequestFactory
func LayerIdsReqFactory ¶
func LayerIdsReqFactory(lyr types.LayerID) RequestFactory
func PoetReqFactory ¶
func PoetReqFactory(poetProofRef []byte) RequestFactory
type SValidateAtxFunc ¶
type SValidateAtxFunc func(atx *types.ActivationTx) error
type StateMock ¶
type StateMock struct{}
func (*StateMock) ApplyRewards ¶
func (*StateMock) ApplyTransactions ¶
type Syncer ¶
type Syncer struct { Configuration log.Log *mesh.Mesh BlockEligibilityValidator TickProvider // contains filtered or unexported fields }
func NewSync ¶
func NewSync(srv service.Service, layers *mesh.Mesh, txpool TxMemPool, atxpool AtxMemPool, bv BlockEligibilityValidator, poetdb PoetDb, conf Configuration, clock TickProvider, logger log.Log) *Syncer
fires a sync every sm.SyncInterval or on force space from outside
func (*Syncer) DataAvailability ¶
func (s *Syncer) DataAvailability(blk *types.Block) ([]*types.Transaction, []*types.ActivationTx, error)
func (*Syncer) FetchPoetProof ¶
func (Syncer) GetTimeout ¶
func (*Syncer) ListenToGossip ¶
api for other modules to check if they should listen to gossip
func (*Syncer) ValidatingLayer ¶
type SyntacticValidatorMock ¶
type SyntacticValidatorMock struct { }
func (SyntacticValidatorMock) SyntacticallyValid ¶
func (SyntacticValidatorMock) SyntacticallyValid(block *types.BlockHeader) (bool, error)
type TickProvider ¶
type TickProvider interface { Subscribe() timesync.LayerTimer Unsubscribe(timer timesync.LayerTimer) GetCurrentLayer() types.LayerID }
type TxMemPool ¶
type TxMemPool interface { Get(id types.TransactionId) (*types.Transaction, error) Put(id types.TransactionId, item *types.Transaction) }
type ValidationInfra ¶
type ValidationInfra interface { DataAvailability(blk *types.Block) ([]*types.Transaction, []*types.ActivationTx, error) AddBlockWithTxs(blk *types.Block, txs []*types.Transaction, atxs []*types.ActivationTx) error GetBlock(id types.BlockID) (*types.Block, error) ForBlockInView(view map[types.BlockID]struct{}, layer types.LayerID, blockHandler func(block *types.Block) (bool, error)) error HandleLateBlock(bl *types.Block) ValidatingLayer() types.LayerID ProcessedLayer() types.LayerID // contains filtered or unexported methods }
type ValidatorMock ¶
type ValidatorMock struct{}
func (*ValidatorMock) VerifyPost ¶
Click to show internal directories.
Click to hide internal directories.