node

package
v0.0.1-11-g4f34 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPv4Addr

func IPv4Addr() string

func InitNode

func InitNode() Noder

func NewNode

func NewNode() *node

func NonTLSDial

func NonTLSDial(nodeAddr string) (net.Conn, error)

func TLSDial

func TLSDial(nodeAddr string) (net.Conn, error)

Types

type ConnectingNodes

type ConnectingNodes struct {
	sync.RWMutex
	ConnectingAddrs []string
}

type KnownAddress

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

func (*KnownAddress) GetID

func (ka *KnownAddress) GetID() uint64

func (*KnownAddress) LastAttempt

func (ka *KnownAddress) LastAttempt() time.Time

func (*KnownAddress) NetAddress

func (ka *KnownAddress) NetAddress() NodeAddr

func (*KnownAddress) SaveAddr

func (ka *KnownAddress) SaveAddr(na NodeAddr)

type KnownAddressList

type KnownAddressList struct {
	sync.RWMutex
	List map[uint64]*KnownAddress
	// contains filtered or unexported fields
}

func (*KnownAddressList) AddAddressToKnownAddress

func (al *KnownAddressList) AddAddressToKnownAddress(na NodeAddr)

func (*KnownAddressList) AddressExisted

func (al *KnownAddressList) AddressExisted(uid uint64) bool

func (*KnownAddressList) DelAddressFromList

func (al *KnownAddressList) DelAddressFromList(id uint64) bool

func (*KnownAddressList) GetAddressCnt

func (al *KnownAddressList) GetAddressCnt() uint64

func (*KnownAddressList) NeedMoreAddresses

func (al *KnownAddressList) NeedMoreAddresses() bool

func (*KnownAddressList) RandGetAddresses

func (al *KnownAddressList) RandGetAddresses(nbrAddrs []NodeAddr) []NodeAddr

func (*KnownAddressList) RandSelectAddresses

func (al *KnownAddressList) RandSelectAddresses() []NodeAddr

func (*KnownAddressList) UpdateAddress

func (al *KnownAddressList) UpdateAddress(id uint64, na NodeAddr)

func (*KnownAddressList) UpdateLastDisconn

func (al *KnownAddressList) UpdateLastDisconn(id uint64)

type Semaphore

type Semaphore chan struct{}

func MakeSemaphore

func MakeSemaphore(n int) Semaphore

type TXNPool

type TXNPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*TXNPool) AppendToTxnPool

func (this *TXNPool) AppendToTxnPool(txn *transaction.Transaction) ErrCode

append transaction to txnpool when check ok. 1.check transaction. 2.check with ledger(db) 3.check with pool

func (*TXNPool) CleanSubmittedTransactions

func (this *TXNPool) CleanSubmittedTransactions(block *ledger.Block) error

clean the trasaction Pool with committed block.

func (*TXNPool) GetTransaction

func (this *TXNPool) GetTransaction(hash common.Uint256) *transaction.Transaction

get the transaction by hash

func (*TXNPool) GetTransactionCount

func (this *TXNPool) GetTransactionCount() int

func (*TXNPool) GetTxnPool

func (this *TXNPool) GetTxnPool(byCount bool) map[common.Uint256]*transaction.Transaction

get the transaction in txnpool

func (*TXNPool) MaybeAcceptTransaction

func (this *TXNPool) MaybeAcceptTransaction(txn *tx.Transaction) error

func (*TXNPool) RemoveTransaction

func (this *TXNPool) RemoveTransaction(txn *tx.Transaction)

Jump to

Keyboard shortcuts

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