node

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetBlocks

type GetBlocks struct {
	Version uint32

	//TODO: blockchain support locator
	LocatorHashes []crypto.Hash
	HashStop      crypto.Hash
}

GetBlocks represents a getblocks message

type GetData

type GetData struct {
	InvList []InvVect
}

GetData represents a getdata message

type InvType

type InvType uint8

InvType represents the allowed types of inventory vectors

const (
	// InvTypeTx represents the transaction types
	InvTypeTx InvType = iota
	// InvTypeBlock represents the block types
	InvTypeBlock
)

type InvVect

type InvVect struct {
	Type   InvType
	Hashes []crypto.Hash
}

InvVect defines a inventory vector which is used to describe data,

type ProtocolManager

type ProtocolManager struct {
	*blockchain.Blockchain
	*ledger.Ledger
	*keystore.KeyStore
	*p2p.Server
	// contains filtered or unexported fields
}

ProtocolManager manages the protocol

func NewProtocolManager

func NewProtocolManager(db *db.BlockchainDB, netConfig *p2p.Config,
	blockchain *blockchain.Blockchain, consenter consensus.Consenter,
	ledger *ledger.Ledger, ks *keystore.KeyStore,
	mergeConfig *merge.Config, logDir string) *ProtocolManager

NewProtocolManager returns a new sub protocol manager.

func (*ProtocolManager) OnBlock

func (pm *ProtocolManager) OnBlock(m p2p.Msg, peer *p2p.Peer)

func (*ProtocolManager) OnConsensus

func (pm *ProtocolManager) OnConsensus(m p2p.Msg, peer *p2p.Peer)

OnConsensus processes consensus message

func (*ProtocolManager) OnGetBlocks

func (pm *ProtocolManager) OnGetBlocks(m p2p.Msg, peer *p2p.Peer)

OnGetBlocks processes getblocks message

func (*ProtocolManager) OnGetData

func (pm *ProtocolManager) OnGetData(m p2p.Msg, peer *p2p.Peer)

OnGetData processes getdata message

func (*ProtocolManager) OnInv

func (pm *ProtocolManager) OnInv(m p2p.Msg, peer *p2p.Peer)

OnInv processes inventory message

func (*ProtocolManager) OnStatus

func (pm *ProtocolManager) OnStatus(m p2p.Msg, p *p2p.Peer)

OnStatus handles statusMsg

func (*ProtocolManager) OnTx

func (pm *ProtocolManager) OnTx(m p2p.Msg, p *p2p.Peer)

OnTx processes tx message

func (*ProtocolManager) Relay

func (pm *ProtocolManager) Relay(inv types.IInventory)

Relay relays inventory to remote peers

func (*ProtocolManager) SendMsgnetMessage

func (pm *ProtocolManager) SendMsgnetMessage(src, dst string, msg msgnet.Message) bool

SendMsgnetMessage sends message to msg-net

func (ProtocolManager) Sign

func (pm ProtocolManager) Sign(data []byte) (*crypto.Signature, error)

Sign signs data with nodekey

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start()

Start starts a protocol server

type StatusData

type StatusData struct {
	Version     uint32
	StartHeight uint32 //uint64
}

StatusData represents a status message

Jump to

Keyboard shortcuts

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