Documentation
¶
Index ¶
- type BlockHashRequestMessage
- type BlockHashResponseMessage
- type BlockRequestMessage
- type BlockResponseMessage
- type ChainInfoRequestMessage
- type ChainInfoResponseMessage
- type DecodedMessage
- type Message
- type MessageType
- type NetAddr
- type Node
- type NodeOpts
- type RPC
- type RPCDecodeFunc
- type RPCProcessor
- type TCPPeer
- type TCPTransport
- type Transport
- type TxPool
- type TxSortedMap
- func (t *TxSortedMap) Add(tx *types.Transaction)
- func (t *TxSortedMap) Clear()
- func (t *TxSortedMap) Contains(h common.Hash) bool
- func (t *TxSortedMap) Count() int
- func (t *TxSortedMap) First() *types.Transaction
- func (t *TxSortedMap) Get(h common.Hash) *types.Transaction
- func (t *TxSortedMap) Remove(h common.Hash)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockHashRequestMessage ¶
type BlockHashRequestMessage struct {
Height int32
}
type BlockRequestMessage ¶
type BlockRequestMessage struct {
Height int32
}
type BlockResponseMessage ¶
type ChainInfoRequestMessage ¶
type ChainInfoRequestMessage struct { }
type DecodedMessage ¶
func DecodeRPCDefaultFunc ¶
func DecodeRPCDefaultFunc(rpc RPC) (*DecodedMessage, error)
type Message ¶
type Message struct { Header MessageType Data []byte }
func NewMessage ¶
func NewMessage(t MessageType, data []byte) *Message
type MessageType ¶
type MessageType byte
const ( MessageTypeTx MessageType = 0x1 MessageTypeBlock MessageType = 0x2 MessageTypeChainInfoResponse MessageType = 0x3 MessageTypeChainInfoRequest MessageType = 0x4 MessageTypeBlockRequest MessageType = 0x5 MessageTypeBlockResponse MessageType = 0x6 MessageTypeBlockHashRequest MessageType = 0x7 MessageTypeBlockHashResponse MessageType = 0x8 )
type Node ¶
type Node struct { TCPTransport *TCPTransport NodeOpts // contains filtered or unexported fields }
func (*Node) HandleMessage ¶
func (n *Node) HandleMessage(msg *DecodedMessage) error
type NodeOpts ¶
type NodeOpts struct { APIListenAddr string SeedNodes []string ListenAddr string TCPTransport *TCPTransport Name string Logger log.Logger RPCDecodeFunc RPCDecodeFunc RPCProcessor RPCProcessor BlockTime time.Duration PrivateKey *types.PrivateKey }
type RPCDecodeFunc ¶
type RPCDecodeFunc func(RPC) (*DecodedMessage, error)
type RPCProcessor ¶
type RPCProcessor interface {
HandleMessage(*DecodedMessage) error
}
type TCPTransport ¶
type TCPTransport struct {
// contains filtered or unexported fields
}
func NewTCPTransport ¶
func NewTCPTransport(addr string, peerCh chan *TCPPeer) *TCPTransport
func (*TCPTransport) Start ¶
func (t *TCPTransport) Start() error
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
func (*TxPool) Add ¶
func (p *TxPool) Add(tx *types.Transaction, chain *core.Blockchain) error
func (*TxPool) ClearPending ¶
func (p *TxPool) ClearPending()
func (*TxPool) Pending ¶
func (p *TxPool) Pending() []*types.Transaction
func (*TxPool) PendingCount ¶
type TxSortedMap ¶
type TxSortedMap struct {
// contains filtered or unexported fields
}
func NewTxSortedMap ¶
func NewTxSortedMap() *TxSortedMap
func (*TxSortedMap) Add ¶
func (t *TxSortedMap) Add(tx *types.Transaction)
func (*TxSortedMap) Clear ¶
func (t *TxSortedMap) Clear()
func (*TxSortedMap) Count ¶
func (t *TxSortedMap) Count() int
func (*TxSortedMap) First ¶
func (t *TxSortedMap) First() *types.Transaction
func (*TxSortedMap) Get ¶
func (t *TxSortedMap) Get(h common.Hash) *types.Transaction
func (*TxSortedMap) Remove ¶
func (t *TxSortedMap) Remove(h common.Hash)
Click to show internal directories.
Click to hide internal directories.