node

package
v0.0.0-...-4701ab3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: LGPL-3.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTimestamp     = errors.New("invalid timestamp")
	ErrNotAllowedPublicHash = errors.New("not allowed public hash")
)

errors

Functions

This section is empty.

Types

type Config

type Config struct {
	ChainCoord *common.Coordinate
	SeedNodes  []string
	Router     router.Config
	Peer       peer.Config
}

type Node

type Node struct {
	sync.Mutex
	Config *Config
	// contains filtered or unexported fields
}

Node validates and shares the block chain

func NewNode

func NewNode(Config *Config, kn *kernel.Kernel) (*Node, error)

NewNode returns a Node

func (*Node) AfterProcessBlock

func (nd *Node) AfterProcessBlock(kn *kernel.Kernel, b *block.Block, s *block.ObserverSigned, ctx *data.Context)

AfterProcessBlock called when processed block to the chain

func (*Node) AfterPushTransaction

func (nd *Node) AfterPushTransaction(kn *kernel.Kernel, tx transaction.Transaction, sigs []common.Signature)

AfterPushTransaction called when pushed a transaction to the transaction pool

func (*Node) Close

func (nd *Node) Close()

Close terminates the formulator

func (*Node) CommitTransaction

func (nd *Node) CommitTransaction(tx transaction.Transaction, sigs []common.Signature) error

CommitTransaction adds and broadcasts transaction

func (*Node) DebugLog

func (nd *Node) DebugLog(kn *kernel.Kernel, args ...interface{})

DebugLog TEMP

func (*Node) DoTransactionBroadcast

func (nd *Node) DoTransactionBroadcast(kn *kernel.Kernel, msg *message_def.TransactionMessage)

DoTransactionBroadcast called when a transaction need to be broadcast

func (*Node) OnConnected

func (nd *Node) OnConnected(p mesh.Peer)

OnConnected is called after a new peer is connected

func (*Node) OnDisconnected

func (nd *Node) OnDisconnected(p mesh.Peer)

OnDisconnected is called when the peer is disconnected

func (*Node) OnProcessBlock

func (nd *Node) OnProcessBlock(kn *kernel.Kernel, b *block.Block, s *block.ObserverSigned, ctx *data.Context) error

OnProcessBlock called when processing block to the chain (error prevent processing block)

func (*Node) OnPushTransaction

func (nd *Node) OnPushTransaction(kn *kernel.Kernel, tx transaction.Transaction, sigs []common.Signature) error

OnPushTransaction called when pushing a transaction to the transaction pool (error prevent push transaction)

func (*Node) OnRecv

func (nd *Node) OnRecv(p mesh.Peer, r io.Reader, t message.Type) error

OnRecv is called when a message is received from the peer

func (*Node) Run

func (nd *Node) Run()

Run runs the node

Jump to

Keyboard shortcuts

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