kernel

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: GPL-3.0 Imports: 16 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 ConsensusNodes added in v0.1.0

func ConsensusNodes() []map[string]interface{}

func Loop added in v0.1.0

func Loop(store storage.Store, addr string, dir string) error

func NetworkId added in v0.1.0

func NetworkId() crypto.Hash

func NodeIdForNetwork added in v0.1.0

func NodeIdForNetwork() crypto.Hash

func QueueTransaction added in v0.1.0

func QueueTransaction(store storage.Store, tx *common.SignedTransaction) (string, error)

func TopologicalOrder added in v0.1.0

func TopologicalOrder() uint64

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

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

func (*Node) CacheVerify

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

func (*Node) CheckSync added in v0.1.0

func (node *Node) CheckSync() bool

func (*Node) ConsumeMempool added in v0.1.0

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

func (node *Node) LoadNodeState() 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) 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) UpdateSyncPoint

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

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