kernel

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinimumNodeCount = 7
	PledgeAmount     = 10000
)
View Source
const (
	MempoolSize = 8192
)

Variables

View Source
var (
	MintPool        common.Integer
	MintYearShares  int
	MintYearBatches int
)

Functions

func ComputeRoundHash

func ComputeRoundHash(nodeId crypto.Hash, number uint64, snapshots []*common.Snapshot) (uint64, uint64, crypto.Hash)

Types

type CacheRound

type CacheRound struct {
	NodeId     crypto.Hash
	Number     uint64
	Timestamp  uint64
	References *common.RoundLink
	Snapshots  []*common.Snapshot `msgpack:"-"`
}

func (*CacheRound) Copy

func (c *CacheRound) Copy() *CacheRound

func (*CacheRound) Gap

func (c *CacheRound) Gap() (uint64, uint64)

func (*CacheRound) ValidateSnapshot

func (c *CacheRound) ValidateSnapshot(s *common.Snapshot, add bool) bool

type FinalRound

type FinalRound struct {
	NodeId crypto.Hash
	Number uint64
	Start  uint64
	End    uint64
	Hash   crypto.Hash
}

func (*FinalRound) Copy

func (f *FinalRound) Copy() *FinalRound

type Genesis

type Genesis struct {
	Epoch int64 `json:"epoch"`
	Nodes []struct {
		Signer  common.Address `json:"signer"`
		Payee   common.Address `json:"payee"`
		Balance common.Integer `json:"balance"`
	} `json:"nodes"`
	Domains []struct {
		Signer  common.Address `json:"signer"`
		Balance common.Integer `json:"balance"`
	} `json:"domains"`
}

type Node

type Node struct {
	IdForNetwork   crypto.Hash
	Signer         common.Address
	Graph          *RoundGraph
	TopoCounter    *TopologicalSequence
	SnapshotsPool  map[crypto.Hash][]*crypto.Signature
	SignaturesPool map[crypto.Hash]*crypto.Signature
	CachePool      map[crypto.Hash][]*common.Snapshot

	Peer       *network.Peer
	SyncPoints *syncMap
	Listener   string

	ConsensusNodes    map[crypto.Hash]*common.Node
	ConsensusBase     int
	ConsensusPledging *common.Node
	// contains filtered or unexported fields
}

func SetupNode

func SetupNode(persistStore storage.Store, cacheStore *fastcache.Cache, addr string, dir string) (*Node, error)

func (*Node) AddNeighborsFromConfig

func (node *Node) AddNeighborsFromConfig() error

func (*Node) Authenticate

func (node *Node) Authenticate(msg []byte) (crypto.Hash, string, error)

func (*Node) BuildAuthenticationMessage

func (node *Node) BuildAuthenticationMessage() []byte

func (*Node) BuildGraph

func (node *Node) BuildGraph() []*network.SyncPoint

func (*Node) CachePutTransaction

func (node *Node) CachePutTransaction(peerId crypto.Hash, tx *common.VersionedTransaction) error

func (*Node) CacheVerify

func (node *Node) CacheVerify(snap crypto.Hash, sig crypto.Signature, pub crypto.Key) bool

func (*Node) CheckBroadcastedToPeers

func (node *Node) CheckBroadcastedToPeers() bool

func (*Node) CheckCatchUpWithPeers

func (node *Node) CheckCatchUpWithPeers() bool

func (*Node) ConsumeMempool added in v0.1.0

func (node *Node) ConsumeMempool() error

func (*Node) ConsumeQueue

func (node *Node) ConsumeQueue() error

func (*Node) ElectionLoop

func (node *Node) ElectionLoop() error

func (*Node) GetCacheStore

func (node *Node) GetCacheStore() *fastcache.Cache

func (*Node) ListenNeighbors

func (node *Node) ListenNeighbors() error

func (*Node) LoadCacheToQueue

func (node *Node) LoadCacheToQueue() error

func (*Node) LoadConsensusNodes

func (node *Node) LoadConsensusNodes() error

func (*Node) LoadGenesis

func (node *Node) LoadGenesis(configDir string) error

func (*Node) LoadNodeConfig

func (node *Node) LoadNodeConfig()

func (*Node) Loop

func (node *Node) Loop() error

func (*Node) MintLoop

func (node *Node) MintLoop() error

func (*Node) NetworkId

func (node *Node) NetworkId() crypto.Hash

func (*Node) QueueAppendSnapshot

func (node *Node) QueueAppendSnapshot(peerId crypto.Hash, s *common.Snapshot, final bool) error

func (*Node) QueueTransaction

func (node *Node) QueueTransaction(tx *common.VersionedTransaction) (string, error)

func (*Node) ReadSnapshotsForNodeRound

func (node *Node) ReadSnapshotsForNodeRound(nodeIdWithNetwork crypto.Hash, round uint64) ([]*common.SnapshotWithTopologicalOrder, error)

func (*Node) ReadSnapshotsSinceTopology

func (node *Node) ReadSnapshotsSinceTopology(offset, count uint64) ([]*common.SnapshotWithTopologicalOrder, error)

func (*Node) SendTransactionToPeer

func (node *Node) SendTransactionToPeer(peerId, hash crypto.Hash) error

func (*Node) TopologicalOrder

func (node *Node) TopologicalOrder() uint64

func (*Node) UpdateSyncPoint

func (node *Node) UpdateSyncPoint(peerId crypto.Hash, points []*network.SyncPoint)

func (*Node) Uptime

func (node *Node) Uptime() time.Duration

func (*Node) VerifyAndQueueAppendSnapshot added in v0.3.3

func (node *Node) VerifyAndQueueAppendSnapshot(peerId crypto.Hash, s *common.Snapshot) error

type RoundGraph

type RoundGraph struct {
	Nodes      []*crypto.Hash
	CacheRound map[crypto.Hash]*CacheRound
	FinalRound map[crypto.Hash]*FinalRound

	RoundHistory map[crypto.Hash][]*FinalRound

	GraphTimestamp uint64
	FinalCache     []*network.SyncPoint
	MyCacheRound   *CacheRound
	MyFinalNumber  uint64
}

func LoadRoundGraph

func LoadRoundGraph(store storage.Store, networkId, idForNetwork crypto.Hash) (*RoundGraph, error)

func (*RoundGraph) Print

func (g *RoundGraph) Print() string

func (*RoundGraph) UpdateFinalCache

func (g *RoundGraph) UpdateFinalCache(idForNetwork crypto.Hash)

type TopologicalSequence

type TopologicalSequence struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*TopologicalSequence) Next

func (c *TopologicalSequence) Next() uint64

Jump to

Keyboard shortcuts

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