Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecodedMessage ¶
func DefaultRPCDecodeFunc ¶
func DefaultRPCDecodeFunc(rpc RPC) (*DecodedMessage, error)
type LocalTransport ¶
type LocalTransport struct {
// contains filtered or unexported fields
}
func NewLocalTransport ¶
func NewLocalTransport(addr NetAddr) *LocalTransport
func (*LocalTransport) Addr ¶
func (t *LocalTransport) Addr() NetAddr
func (*LocalTransport) Broadcast ¶
func (t *LocalTransport) Broadcast(payload []byte) error
func (*LocalTransport) Connect ¶
func (t *LocalTransport) Connect(tr Transport) error
func (*LocalTransport) Consume ¶
func (t *LocalTransport) Consume() <-chan RPC
func (*LocalTransport) SendMessage ¶
func (t *LocalTransport) SendMessage(to NetAddr, payload []byte) error
type Message ¶
type Message struct { Header MessageType Data []byte }
func NewMessage ¶
func NewMessage(t MessageType, data []byte) *Message
type RPCDecodeFunc ¶
type RPCDecodeFunc func(RPC) (*DecodedMessage, error)
type RPCProcessor ¶
type RPCProcessor interface {
ProcessMessage(*DecodedMessage) error
}
type Server ¶
type Server struct { ServerOpts // contains filtered or unexported fields }
func NewServer ¶
func NewServer(opts ServerOpts) *Server
func (*Server) ProcessMessage ¶
func (s *Server) ProcessMessage(msg *DecodedMessage) error
type ServerOpts ¶
type ServerOpts struct { RPCDecodeFunc RPCDecodeFunc RPCProcessor RPCProcessor Transports []Transport BlockTime time.Duration PrivateKey *crypto.PrivateKey }
type TxMapSorter ¶
type TxMapSorter struct {
// contains filtered or unexported fields
}
func NewTxMapSorter ¶
func NewTxMapSorter(txMap map[types.Hash]*core.Transaction) *TxMapSorter
func (*TxMapSorter) Len ¶
func (s *TxMapSorter) Len() int
func (*TxMapSorter) Less ¶
func (s *TxMapSorter) Less(i, j int) bool
func (*TxMapSorter) Swap ¶
func (s *TxMapSorter) Swap(i, j int)
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
func (*TxPool) Add ¶
func (p *TxPool) Add(tx *core.Transaction) error
Add adds an transaction to the pool, the caller is responsible checking if the tx already exist.
func (*TxPool) Transactions ¶
func (p *TxPool) Transactions() []*core.Transaction
Click to show internal directories.
Click to hide internal directories.