Documentation ¶
Index ¶
- func NewAddBlock(blockData []byte) *message.Msg
- func NewAddTXMessage(txData []byte) *message.Msg
- type Node
- func (n *Node) GetBalance(ctx context.Context, in *cli.GetBalanceRequest) (*cli.GetBalanceResponse, error)
- func (n *Node) Message(msgStream message.MessageService_MessageServer) error
- func (n *Node) Send(ctx context.Context, r *cli.SendRequest) (*cli.SendResponse, error)
- func (n *Node) ServeClient(stream message.MessageService_MessageClient)
- type PeerManager
- func (m *PeerManager) AddClient(c message.MessageService_MessageClient) error
- func (m *PeerManager) AddServer(s message.MessageService_MessageServer) error
- func (m *PeerManager) RemoveClient(addr string)
- func (m *PeerManager) RemoveServer(addr string)
- func (m *PeerManager) Send(ctx context.Context, msg *message.Msg)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAddBlock ¶
NewAddBlock creates a new Block message
func NewAddTXMessage ¶
NewAddTXMessage creates a new TX message
Types ¶
type Node ¶
type Node struct { PeerManager *PeerManager MemPool *mempool.MemPool Storage blockchain.Storage Signer transaction.Signer Validator consensus.Validator Wallet *wallet.Wallet }
Node represents a single node that can send/relay/validate messages. It has access to the wallet for GetBalance command.
func (*Node) GetBalance ¶
func (n *Node) GetBalance(ctx context.Context, in *cli.GetBalanceRequest) (*cli.GetBalanceResponse, error)
GetBalance returns sum of all UTXO of all addresses in the wallet
func (*Node) Message ¶
func (n *Node) Message(msgStream message.MessageService_MessageServer) error
Message starts listening a given server stream
func (*Node) Send ¶
func (n *Node) Send(ctx context.Context, r *cli.SendRequest) (*cli.SendResponse, error)
Send sends a TX message to the network
func (*Node) ServeClient ¶
func (n *Node) ServeClient(stream message.MessageService_MessageClient)
ServeClient starts listening a given client stream
type PeerManager ¶
PeerManager represents a manager that knows all about the node connections
func (*PeerManager) AddClient ¶
func (m *PeerManager) AddClient(c message.MessageService_MessageClient) error
AddClient adds a client stream
func (*PeerManager) AddServer ¶
func (m *PeerManager) AddServer(s message.MessageService_MessageServer) error
AddServer adds a server stream
func (*PeerManager) RemoveClient ¶
func (m *PeerManager) RemoveClient(addr string)
RemoveClient removes a client stream
func (*PeerManager) RemoveServer ¶
func (m *PeerManager) RemoveServer(addr string)
RemoveServer removes a server stream
Click to show internal directories.
Click to hide internal directories.