kernel

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: GPL-3.0 Imports: 16 Imported by: 2

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

This section is empty.

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
	ConsensusNodes map[crypto.Hash]*common.Node
	Graph          *RoundGraph
	TopoCounter    *TopologicalSequence
	SnapshotsPool  map[crypto.Hash][]*crypto.Signature
	SignaturesPool map[crypto.Hash]*crypto.Signature
	CachePool      []*common.Snapshot

	Peer       *network.Peer
	SyncPoints *syncMap
	// contains filtered or unexported fields
}

func SetupNode

func SetupNode(store storage.Store, 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, 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(tx *common.VersionedTransaction) error

func (*Node) CacheVerify

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

func (*Node) CheckCatchUp added in v0.1.4

func (node *Node) CheckCatchUp() bool

func (*Node) CheckSync

func (node *Node) CheckSync() bool

func (*Node) ConsumeMempool

func (node *Node) ConsumeMempool() error

func (*Node) ConsumeQueue

func (node *Node) ConsumeQueue() error

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) LoadNodeState

func (node *Node) LoadNodeState() error

func (*Node) Loop added in v0.1.2

func (node *Node) Loop() error

func (*Node) MintLoop added in v0.1.1

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) error

func (*Node) QueueTransaction added in v0.1.2

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 added in v0.1.2

func (node *Node) TopologicalOrder() uint64

func (*Node) UpdateSyncPoint

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

func (*Node) Uptime added in v0.1.14

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

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   *FinalRound
	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