node

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NothingToRequestErr = errors.New("nothing ot request")
View Source
var TimeoutErr = errors.New("timeout")

Functions

func NewMockPeerManagerWithDefaultPeer

func NewMockPeerManagerWithDefaultPeer() (*mockPeerManager, *mock.Peer)

func PreloadSignatures

func PreloadSignatures(ctx context.Context, out chan crypto.Signature, p sendMessage, lastSignatures *Signatures, subscribe subscriber) error

func RunNode

func RunNode(ctx context.Context, n *Node, p peer.Parent)

Types

type BlockApplier

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

func NewBlockApplier

func NewBlockApplier(state state.State, blockAddedNotifier types.Handler, scheduler types.Scheduler) *BlockApplier

func (*BlockApplier) Apply

func (a *BlockApplier) Apply(block *proto.Block) error

1) interrupt miner 2) notify peers about score 3) reshedule

func (*BlockApplier) ApplyBytes

func (a *BlockApplier) ApplyBytes(b []byte) error

type BlockWithBytes

type BlockWithBytes struct {
	Block *proto.Block
	Bytes []byte
}

type Config

type Config struct {
	AppName  string
	NodeName string
	Listen   string
	DeclAddr string
}

type MockStateManager

type MockStateManager struct {
	Peers_ []proto.TCPAddr
	// contains filtered or unexported fields
}

func NewMockStateManager

func NewMockStateManager(blocks ...*proto.Block) (*MockStateManager, error)

func (*MockStateManager) AccountBalance

func (a *MockStateManager) AccountBalance(account proto.Recipient, asset []byte) (uint64, error)

func (*MockStateManager) ActivationHeight

func (a *MockStateManager) ActivationHeight(featureID int16) (uint64, error)

func (*MockStateManager) AddBlock

func (a *MockStateManager) AddBlock([]byte) (*proto.Block, error)

func (*MockStateManager) AddBlocks

func (a *MockStateManager) AddBlocks(blocks [][]byte, initialisation bool) error

func (*MockStateManager) AddDeserializedBlock

func (a *MockStateManager) AddDeserializedBlock(block *proto.Block) (*proto.Block, error)

func (*MockStateManager) AddNewBlocks

func (a *MockStateManager) AddNewBlocks(blocks [][]byte) error

func (*MockStateManager) AddNewDeserializedBlocks

func (a *MockStateManager) AddNewDeserializedBlocks(blocks []*proto.Block) error

func (*MockStateManager) AddOldBlocks

func (a *MockStateManager) AddOldBlocks(blocks [][]byte) error

func (*MockStateManager) AddOldDeserializedBlocks

func (a *MockStateManager) AddOldDeserializedBlocks([]*proto.Block) error

func (*MockStateManager) AddingBlockHeight

func (a *MockStateManager) AddingBlockHeight() (proto.Height, error)

func (*MockStateManager) AddrByAlias

func (a *MockStateManager) AddrByAlias(alias proto.Alias) (proto.Address, error)

func (*MockStateManager) AddressesNumber

func (a *MockStateManager) AddressesNumber(wavesonly bool) (uint64, error)

func (*MockStateManager) ApprovalHeight

func (a *MockStateManager) ApprovalHeight(featureID int16) (uint64, error)

func (*MockStateManager) AssetInfo

func (a *MockStateManager) AssetInfo(assetID crypto.Digest) (*proto.AssetInfo, error)

func (*MockStateManager) AssetIsSponsored

func (a *MockStateManager) AssetIsSponsored(assetID crypto.Digest) (bool, error)

func (*MockStateManager) Block

func (a *MockStateManager) Block(blockID crypto.Signature) (*proto.Block, error)

func (*MockStateManager) BlockByHeight

func (a *MockStateManager) BlockByHeight(height proto.Height) (*proto.Block, error)

func (*MockStateManager) BlockBytes

func (a *MockStateManager) BlockBytes(blockID crypto.Signature) ([]byte, error)

func (*MockStateManager) BlockBytesByHeight

func (a *MockStateManager) BlockBytesByHeight(height proto.Height) ([]byte, error)

func (*MockStateManager) BlockIDToHeight

func (a *MockStateManager) BlockIDToHeight(blockID crypto.Signature) (uint64, error)

func (*MockStateManager) BlockchainSettings

func (a *MockStateManager) BlockchainSettings() (*settings.BlockchainSettings, error)

func (*MockStateManager) Close

func (a *MockStateManager) Close() error

func (*MockStateManager) CurrentScore

func (a *MockStateManager) CurrentScore() (*big.Int, error)

func (*MockStateManager) EffectiveBalance

func (a *MockStateManager) EffectiveBalance(account proto.Recipient, startHeight, endHeight uint64) (uint64, error)

func (*MockStateManager) Header

func (a *MockStateManager) Header(block crypto.Signature) (*proto.BlockHeader, error)

func (*MockStateManager) HeaderByHeight

func (a *MockStateManager) HeaderByHeight(height uint64) (*proto.BlockHeader, error)

func (*MockStateManager) HeaderBytes

func (a *MockStateManager) HeaderBytes(blockID crypto.Signature) ([]byte, error)

func (*MockStateManager) HeaderBytesByHeight

func (a *MockStateManager) HeaderBytesByHeight(height uint64) ([]byte, error)

func (*MockStateManager) Height

func (a *MockStateManager) Height() (proto.Height, error)

func (*MockStateManager) HeightToBlockID

func (a *MockStateManager) HeightToBlockID(height uint64) (crypto.Signature, error)

func (*MockStateManager) IsActivated

func (a *MockStateManager) IsActivated(featureID int16) (bool, error)

func (*MockStateManager) IsApproved

func (a *MockStateManager) IsApproved(featureID int16) (bool, error)

func (*MockStateManager) IsNotFound

func (a *MockStateManager) IsNotFound(err error) bool

func (*MockStateManager) Mutex

func (a *MockStateManager) Mutex() *lock.RwMutex

func (*MockStateManager) NewestAccountBalance

func (a *MockStateManager) NewestAccountBalance(account proto.Recipient, asset []byte) (uint64, error)

func (*MockStateManager) NewestAddrByAlias

func (a *MockStateManager) NewestAddrByAlias(alias proto.Alias) (proto.Address, error)

func (*MockStateManager) NewestAssetInfo

func (a *MockStateManager) NewestAssetInfo(assetID crypto.Digest) (*proto.AssetInfo, error)

func (*MockStateManager) NewestAssetIsSponsored

func (a *MockStateManager) NewestAssetIsSponsored(assetID crypto.Digest) (bool, error)

func (*MockStateManager) NewestHeaderByHeight

func (a *MockStateManager) NewestHeaderByHeight(height uint64) (*proto.BlockHeader, error)

func (*MockStateManager) NewestHeight

func (a *MockStateManager) NewestHeight() (proto.Height, error)

func (*MockStateManager) NewestTransactionByID

func (a *MockStateManager) NewestTransactionByID(id []byte) (proto.Transaction, error)

func (*MockStateManager) NewestTransactionHeightByID

func (a *MockStateManager) NewestTransactionHeightByID(id []byte) (proto.Height, error)

func (*MockStateManager) Peers

func (a *MockStateManager) Peers() ([]proto.TCPAddr, error)

func (*MockStateManager) ResetValidationList

func (a *MockStateManager) ResetValidationList()

func (*MockStateManager) RetrieveBinaryEntry

func (a *MockStateManager) RetrieveBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error)

func (*MockStateManager) RetrieveBooleanEntry

func (a *MockStateManager) RetrieveBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error)

func (*MockStateManager) RetrieveEntry

func (a *MockStateManager) RetrieveEntry(account proto.Recipient, key string) (proto.DataEntry, error)

func (*MockStateManager) RetrieveIntegerEntry

func (a *MockStateManager) RetrieveIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error)

func (*MockStateManager) RetrieveNewestBinaryEntry

func (a *MockStateManager) RetrieveNewestBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error)

func (*MockStateManager) RetrieveNewestBooleanEntry

func (a *MockStateManager) RetrieveNewestBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error)

func (*MockStateManager) RetrieveNewestEntry

func (a *MockStateManager) RetrieveNewestEntry(account proto.Recipient, key string) (proto.DataEntry, error)

func (*MockStateManager) RetrieveNewestIntegerEntry

func (a *MockStateManager) RetrieveNewestIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error)

func (*MockStateManager) RetrieveNewestStringEntry

func (a *MockStateManager) RetrieveNewestStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error)

func (*MockStateManager) RetrieveStringEntry

func (a *MockStateManager) RetrieveStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error)

func (*MockStateManager) RollbackTo

func (a *MockStateManager) RollbackTo(removalEdge crypto.Signature) error

func (*MockStateManager) RollbackToHeight

func (a *MockStateManager) RollbackToHeight(height uint64) error

func (*MockStateManager) SavePeers

func (a *MockStateManager) SavePeers([]proto.TCPAddr) error

func (*MockStateManager) ScoreAtHeight

func (a *MockStateManager) ScoreAtHeight(height uint64) (*big.Int, error)

func (*MockStateManager) TransactionByID

func (a *MockStateManager) TransactionByID(id []byte) (proto.Transaction, error)

func (*MockStateManager) TransactionHeightByID

func (a *MockStateManager) TransactionHeightByID(id []byte) (proto.Height, error)

func (*MockStateManager) ValidateNextTx

func (a *MockStateManager) ValidateNextTx(tx proto.Transaction, currentTimestamp, parentTimestamp uint64, version proto.BlockVersion) error

func (*MockStateManager) WavesAddressesNumber

func (a *MockStateManager) WavesAddressesNumber() (uint64, error)

type Node

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

func NewNode

func NewNode(services services.Services, declAddr proto.TCPAddr, ng *ng.RuntimeImpl, interrupter types.MinerInterrupter) *Node

func (*Node) AskPeers

func (a *Node) AskPeers()

func (*Node) Close

func (a *Node) Close()

func (*Node) HandleInfoMessage

func (a *Node) HandleInfoMessage(m peer.InfoMessage)

func (*Node) HandleProtoMessage

func (a *Node) HandleProtoMessage(mess peer.ProtoMessage)

func (*Node) PeerManager

func (a *Node) PeerManager() peer_manager.PeerManager

func (*Node) Serve

func (a *Node) Serve(ctx context.Context) error

func (*Node) SpawnOutgoingConnection

func (a *Node) SpawnOutgoingConnection(ctx context.Context, addr proto.TCPAddr) error

func (*Node) SpawnOutgoingConnections

func (a *Node) SpawnOutgoingConnections(ctx context.Context)

func (*Node) State

func (a *Node) State() state.State

type Signatures

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

func LastSignatures

func LastSignatures(state state.State) (*Signatures, error)

func NewSignatures

func NewSignatures(signatures ...crypto.Signature) *Signatures

func (*Signatures) Exists

func (a *Signatures) Exists(sig crypto.Signature) bool

func (*Signatures) Revert

func (a *Signatures) Revert() *Signatures

func (*Signatures) Signatures

func (a *Signatures) Signatures() []crypto.Signature

type StateSync

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

func NewStateSync

func NewStateSync(services services.Services, subscribe *Subscribe, interrupter types.MinerInterrupter) *StateSync

func (*StateSync) Close

func (a *StateSync) Close()

func (*StateSync) Run

func (a *StateSync) Run(ctx context.Context)

func (*StateSync) Sync

func (a *StateSync) Sync()

type Subscribe

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

func NewSubscribeService

func NewSubscribeService() *Subscribe

func (*Subscribe) Exists

func (a *Subscribe) Exists(id string, responseMessage proto.Message) bool

func (*Subscribe) Receive

func (a *Subscribe) Receive(p peer.Peer, responseMessage proto.Message) bool

Receive tries to apply block to any listener, if no one accepted return `false`, otherwise `true`

func (*Subscribe) Subscribe

func (a *Subscribe) Subscribe(p id, responseMessage proto.Message) (chan proto.Message, func())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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