node

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

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

Go to latest
Published: Feb 11, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NODE_ENV_FULL_SYNC = "full"
	NODE_ENV_DELEGETE  = "delegate"
	FORK_ENV           = "fork"
	Adaptive           = "adaptive"
)

Variables

This section is empty.

Functions

func BlockFromPeer

func BlockFromPeer(clog *ctxlog.ContextLog, block *blockchain.Block)

for delegate node

func GetBlockByHeight

func GetBlockByHeight(chainId, height int64) *blockchain.Header

func GetMainChain

func GetMainChain() *blockchain.BlockChain

func GetVoteResults

func GetVoteResults(chainId int64, hash string) blockchain.Votes

func Init

func Init(env string)

func SuggestFee

func SuggestFee() int64

func VoteFromPeer

func VoteFromPeer(vote blockchain.PeerBlockVote)

func VoteResultFromPeer

func VoteResultFromPeer(votes blockchain.Votes)

Types

type DelegateNode

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

func NewDelegateNode

func NewDelegateNode() *DelegateNode

func (DelegateNode) BlockFromPeer

func (delegate DelegateNode) BlockFromPeer(clog *ctxlog.ContextLog, block *blockchain.Block)

func (DelegateNode) GetBlockByHeight

func (delegate DelegateNode) GetBlockByHeight(chainId, height int64) *blockchain.Block

func (DelegateNode) GetBlockChain

func (delegate DelegateNode) GetBlockChain() *blockchain.BlockChain

func (DelegateNode) GetHeaderByHeight

func (delegate DelegateNode) GetHeaderByHeight(chainId, height int64) *blockchain.Header

func (DelegateNode) GetVoteResults

func (delegate DelegateNode) GetVoteResults(chainId int64, hash string) blockchain.Votes

func (DelegateNode) RecoverFromDB

func (delegate DelegateNode) RecoverFromDB()

func (DelegateNode) StartNode

func (delegate DelegateNode) StartNode()

func (DelegateNode) VoteFromPeer

func (delegate DelegateNode) VoteFromPeer(vote blockchain.PeerBlockVote)

func (DelegateNode) VoteResultFromPeer

func (delegate DelegateNode) VoteResultFromPeer(votes blockchain.Votes)

type ForkNode

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

func NewForkNode

func NewForkNode() *ForkNode

func (ForkNode) BlockFromPeer

func (node ForkNode) BlockFromPeer(clog *ctxlog.ContextLog, block *blockchain.Block)

func (ForkNode) GetBlockByHeight

func (node ForkNode) GetBlockByHeight(chainId, height int64) *blockchain.Block

func (ForkNode) GetBlockChain

func (node ForkNode) GetBlockChain() *blockchain.BlockChain

func (ForkNode) GetHeaderByHeight

func (node ForkNode) GetHeaderByHeight(chainId, height int64) *blockchain.Header

func (ForkNode) GetVoteResults

func (node ForkNode) GetVoteResults(chainId int64, hash string) blockchain.Votes

func (ForkNode) StartNode

func (node ForkNode) StartNode()

func (ForkNode) VoteFromPeer

func (node ForkNode) VoteFromPeer(vote blockchain.PeerBlockVote)

func (ForkNode) VoteResultFromPeer

func (node ForkNode) VoteResultFromPeer(votes blockchain.Votes)

type FullNode

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

func NewFullMode

func NewFullMode() *FullNode

func (FullNode) BlockFromPeer

func (node FullNode) BlockFromPeer(clog *ctxlog.ContextLog, block *blockchain.Block)

func (FullNode) GetBlockByHeight

func (node FullNode) GetBlockByHeight(chainId, height int64) *blockchain.Block

func (FullNode) GetBlockChain

func (node FullNode) GetBlockChain() *blockchain.BlockChain

func (FullNode) GetHeaderByHeight

func (node FullNode) GetHeaderByHeight(chainId, height int64) *blockchain.Header

func (FullNode) GetVoteResults

func (node FullNode) GetVoteResults(chainId int64, hash string) blockchain.Votes

func (FullNode) StartNode

func (node FullNode) StartNode()

func (FullNode) VoteFromPeer

func (node FullNode) VoteFromPeer(vote blockchain.PeerBlockVote)

func (FullNode) VoteResultFromPeer

func (node FullNode) VoteResultFromPeer(votes blockchain.Votes)

type Node

type Node interface {
	StartNode()

	GetBlockChain() *blockchain.BlockChain
	GetVoteResults(chainId int64, hash string) blockchain.Votes
	GetHeaderByHeight(chainId, height int64) *blockchain.Header
	GetBlockByHeight(chainId, height int64) *blockchain.Block

	BlockFromPeer(clog *ctxlog.ContextLog, block *blockchain.Block)
	VoteFromPeer(vote blockchain.PeerBlockVote)
	VoteResultFromPeer(votes blockchain.Votes)
}

Jump to

Keyboard shortcuts

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