types

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address interface {
}

type Conn

type Conn struct {
	Stream network.Stream
	PeerId peer.ID
	Create CreateConnF
}

func (*Conn) Close

func (s *Conn) Close()

type CreateConnF

type CreateConnF func(peerId peer.ID) (network.Stream, error)

type IAccount

type IAccount interface {
	NeedUpdate() bool
	UpdateLocked(confirmed uint64) error
	FromMessage(msg IMessage, height uint64) error
	ToMessage(msg IMessage, height uint64) error
	EaterMessage(msg IMessage, height uint64) error
	Check(msg IMessage, strict bool) error
	Bytes() []byte
	GetAddress() arry.Address
	GetBalance(tokenAddr arry.Address) uint64
}

type IActStatus

type IActStatus interface {
	Nonce(arry.Address) uint64
	SetTrieRoot(hash arry.Hash) error
	TrieRoot() arry.Hash
	SetConfirmed(confirmed uint64)
	Account(address arry.Address) IAccount
	CheckMessage(msg IMessage, strict bool) error
	FromMessage(msg IMessage, height uint64) error
	ToMessage(msg IMessage, height uint64) error
	Commit() (arry.Hash, error)
}

type IBlock

type IBlock interface {
	IHeader
	BlockHeader() IHeader
	BlockBody() IBody
	ToRlpBlock() IRlpBlock
	CheckMsgRoot() bool
}

type IBlocks

type IBlocks interface {
	Blocks() []IBlock
}

type IBody

type IBody interface {
	MsgList() []IMessage
	Count() int
}

type ICandidate

type ICandidate interface {
	GetPeerId() string
	GetSinger() arry.Address
}

type ICandidates

type ICandidates interface {
	Len() int
	List() []ICandidate
	Get(int) ICandidate
	GetPreHash() arry.Hash
}

type IHeader

type IHeader interface {
	GetHash() arry.Hash
	GetPreHash() arry.Hash
	GetMsgRoot() arry.Hash
	GetActRoot() arry.Hash
	GetDPosRoot() arry.Hash
	GetTokenRoot() arry.Hash
	GetSigner() arry.Address
	GetSignature() ISignature
	GetHeight() uint64
	GetTime() uint64
	GetCycle() uint64
	ToRlpHeader() IRlpHeader
	Bytes() []byte
}

type IMessage

type IMessage interface {
	IMessageHeader
	MsgBody() IMessageBody
	ToRlp() IRlpMessage
	Check() error
}

type IMessageBody

type IMessageBody interface {
	MsgTo() arry.Address
	MsgToken() arry.Address
	MsgAmount() uint64
	CheckBody(from arry.Address) error
}

type IMessageHeader

type IMessageHeader interface {
	Type() int
	Hash() arry.Hash
	From() arry.Address
	Nonce() uint64
	Fee() uint64
	Time() uint64
	IsCoinBase() bool
	Signature() string
	PublicKey() string
}

type IMessageIndex

type IMessageIndex interface {
	GetHeight() uint64
}

type IRlpBlock

type IRlpBlock interface {
	Bytes() []byte
	ToBlock() IBlock
}

type IRlpHeader

type IRlpHeader interface {
	Bytes() []byte
}

type IRlpMessage

type IRlpMessage interface {
	Bytes() []byte
}

type ISignature

type ISignature interface {
	PubicKey() []byte
	SignatureBytes() []byte
}

type IToken

type IToken interface {
}

type ITokenStatus

type ITokenStatus interface {
	SetTrieRoot(hash arry.Hash) error
	TrieRoot() arry.Hash
	CheckMessage(msg IMessage) error
	UpdateToken(msg IMessage, height uint64) error
	Token(address arry.Address) (IToken, error)
	Commit() (arry.Hash, error)
}

type Local

type Local struct {
	// Node version
	Version string `json:"version"`
	// Node network
	Network string `json:"network"`
	// Node p2p id
	Peer string `json:"peer"`
	// Node p2p address
	Address string `json:"address"`
	// Linked node
	Connections uint32 `json:"connections"`
	// Pool message
	Messages uint32 `json:"messages"`
	// Current block height
	Height uint64 `json:"height"`
	// Current effective block height
	Confirmed uint64 `json:"confirmed"`
}

type Peer

type Peer struct {
	Private crypto.PrivateKey
	Address *peer.AddrInfo
	Conn    *Conn
	Speed   uint64
}

func NewPeer

func NewPeer(private crypto.PrivateKey, addr *peer.AddrInfo, createF CreateConnF, stream network.Stream) *Peer

Jump to

Keyboard shortcuts

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