Documentation ¶
Index ¶
- Constants
- type BlockMessage
- type BlockchainMessage
- type BlocksMessage
- type FilterAddMessage
- type FilterClearMessage
- type FilterLoadMessage
- type GetBlockMessage
- type GetBlocksMessage
- type GetHeadersMessage
- type GetMerkleBlockMessage
- type HeadersMessage
- type MerkleBlockMessage
- func (m *MerkleBlockMessage) SetRawBlockHeader(bh types.BlockHeader) error
- func (m *MerkleBlockMessage) SetStatusInfo(statusHashes []*bc.Hash, relatedStatuses []*bc.TxVerifyResult) error
- func (m *MerkleBlockMessage) SetTxInfo(txHashes []*bc.Hash, txFlags []uint8, relatedTxs []*types.Tx) error
- func (m *MerkleBlockMessage) String() string
- type MineBlockMessage
- type StatusMessage
- type TransactionMessage
- type TransactionsMessage
Constants ¶
const ( BlockchainChannel = byte(0x40) BlockRequestByte = byte(0x10) BlockResponseByte = byte(0x11) HeadersRequestByte = byte(0x12) HeadersResponseByte = byte(0x13) BlocksRequestByte = byte(0x14) BlocksResponseByte = byte(0x15) StatusByte = byte(0x21) NewTransactionByte = byte(0x30) NewTransactionsByte = byte(0x31) NewMineBlockByte = byte(0x40) FilterLoadByte = byte(0x50) FilterAddByte = byte(0x51) FilterClearByte = byte(0x52) MerkleRequestByte = byte(0x60) MerkleResponseByte = byte(0x61) MaxBlockchainResponseSize = 22020096 + 2 TxsMsgMaxTxNum = 1024 )
protocol msg byte
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockMessage ¶
type BlockMessage struct {
RawBlock []byte
}
BlockMessage response get block msg
func NewBlockMessage ¶
func NewBlockMessage(block *types.Block) (*BlockMessage, error)
NewBlockMessage construct bock response msg
func (*BlockMessage) GetBlock ¶
func (m *BlockMessage) GetBlock() (*types.Block, error)
GetBlock get block from msg
func (*BlockMessage) String ¶
func (m *BlockMessage) String() string
type BlockchainMessage ¶
type BlockchainMessage interface {
String() string
}
BlockchainMessage is a generic message for this reactor.
type BlocksMessage ¶
type BlocksMessage struct {
RawBlocks [][]byte
}
BlocksMessage is one of the bytom msg type
func NewBlocksMessage ¶
func NewBlocksMessage(blocks []*types.Block) (*BlocksMessage, error)
NewBlocksMessage create a new BlocksMessage
func (*BlocksMessage) GetBlocks ¶
func (m *BlocksMessage) GetBlocks() ([]*types.Block, error)
GetBlocks returns the blocks in the msg
func (*BlocksMessage) String ¶
func (m *BlocksMessage) String() string
type FilterAddMessage ¶
type FilterAddMessage struct {
Address []byte
}
FilterAddMessage tells the receiving peer to add address to the filter.
func (*FilterAddMessage) String ¶
func (m *FilterAddMessage) String() string
type FilterClearMessage ¶
type FilterClearMessage struct{}
FilterClearMessage tells the receiving peer to remove a previously-set filter.
func (*FilterClearMessage) String ¶
func (m *FilterClearMessage) String() string
type FilterLoadMessage ¶
type FilterLoadMessage struct {
Addresses [][]byte
}
FilterLoadMessage tells the receiving peer to filter the transactions according to address.
func (*FilterLoadMessage) String ¶
func (m *FilterLoadMessage) String() string
type GetBlockMessage ¶
GetBlockMessage request blocks from remote peers by height/hash
func (*GetBlockMessage) GetHash ¶
func (m *GetBlockMessage) GetHash() *bc.Hash
GetHash reutrn the hash of the request
func (*GetBlockMessage) String ¶
func (m *GetBlockMessage) String() string
type GetBlocksMessage ¶
GetBlocksMessage is one of the bytom msg type
func NewGetBlocksMessage ¶
func NewGetBlocksMessage(blockLocator []*bc.Hash, stopHash *bc.Hash) *GetBlocksMessage
NewGetBlocksMessage create a new GetBlocksMessage
func (*GetBlocksMessage) GetBlockLocator ¶
func (m *GetBlocksMessage) GetBlockLocator() []*bc.Hash
GetBlockLocator return the locator of the msg
func (*GetBlocksMessage) GetStopHash ¶
func (m *GetBlocksMessage) GetStopHash() *bc.Hash
GetStopHash return the stop hash of the msg
func (*GetBlocksMessage) String ¶
func (m *GetBlocksMessage) String() string
type GetHeadersMessage ¶
GetHeadersMessage is one of the bytom msg type
func NewGetHeadersMessage ¶
func NewGetHeadersMessage(blockLocator []*bc.Hash, stopHash *bc.Hash) *GetHeadersMessage
NewGetHeadersMessage return a new GetHeadersMessage
func (*GetHeadersMessage) GetBlockLocator ¶
func (m *GetHeadersMessage) GetBlockLocator() []*bc.Hash
GetBlockLocator return the locator of the msg
func (*GetHeadersMessage) GetStopHash ¶
func (m *GetHeadersMessage) GetStopHash() *bc.Hash
GetStopHash return the stop hash of the msg
func (*GetHeadersMessage) String ¶
func (m *GetHeadersMessage) String() string
type GetMerkleBlockMessage ¶
GetMerkleBlockMessage request merkle blocks from remote peers by height/hash
func (*GetMerkleBlockMessage) GetHash ¶
func (m *GetMerkleBlockMessage) GetHash() *bc.Hash
GetHash reutrn the hash of the request
func (*GetMerkleBlockMessage) String ¶
func (m *GetMerkleBlockMessage) String() string
type HeadersMessage ¶
type HeadersMessage struct {
RawHeaders [][]byte
}
HeadersMessage is one of the bytom msg type
func NewHeadersMessage ¶
func NewHeadersMessage(headers []*types.BlockHeader) (*HeadersMessage, error)
NewHeadersMessage create a new HeadersMessage
func (*HeadersMessage) GetHeaders ¶
func (m *HeadersMessage) GetHeaders() ([]*types.BlockHeader, error)
GetHeaders return the headers in the msg
func (*HeadersMessage) String ¶
func (m *HeadersMessage) String() string
type MerkleBlockMessage ¶
type MerkleBlockMessage struct { RawBlockHeader []byte TxHashes [][32]byte RawTxDatas [][]byte StatusHashes [][32]byte RawTxStatuses [][]byte Flags []byte }
MerkleBlockMessage return the merkle block to client
func NewMerkleBlockMessage ¶
func NewMerkleBlockMessage() *MerkleBlockMessage
NewMerkleBlockMessage construct merkle block message
func (*MerkleBlockMessage) SetRawBlockHeader ¶
func (m *MerkleBlockMessage) SetRawBlockHeader(bh types.BlockHeader) error
func (*MerkleBlockMessage) SetStatusInfo ¶
func (m *MerkleBlockMessage) SetStatusInfo(statusHashes []*bc.Hash, relatedStatuses []*bc.TxVerifyResult) error
func (*MerkleBlockMessage) String ¶
func (m *MerkleBlockMessage) String() string
type MineBlockMessage ¶
type MineBlockMessage struct {
RawBlock []byte
}
MineBlockMessage new mined block msg
func NewMinedBlockMessage ¶
func NewMinedBlockMessage(block *types.Block) (*MineBlockMessage, error)
NewMinedBlockMessage construct new mined block msg
func (*MineBlockMessage) GetMineBlock ¶
func (m *MineBlockMessage) GetMineBlock() (*types.Block, error)
GetMineBlock get mine block from msg
func (*MineBlockMessage) String ¶
func (m *MineBlockMessage) String() string
type StatusMessage ¶
StatusResponseMessage get status response msg
func NewStatusMessage ¶
func NewStatusMessage(blockHeader *types.BlockHeader) *StatusMessage
NewStatusResponseMessage construct get status response msg
func (*StatusMessage) GetHash ¶
func (m *StatusMessage) GetHash() *bc.Hash
GetHash get hash from msg
func (*StatusMessage) String ¶
func (m *StatusMessage) String() string
type TransactionMessage ¶
type TransactionMessage struct {
RawTx []byte
}
TransactionMessage notify new tx msg
func NewTransactionMessage ¶
func NewTransactionMessage(tx *types.Tx) (*TransactionMessage, error)
NewTransactionMessage construct notify new tx msg
func (*TransactionMessage) GetTransaction ¶
func (m *TransactionMessage) GetTransaction() (*types.Tx, error)
GetTransaction get tx from msg
func (*TransactionMessage) String ¶
func (m *TransactionMessage) String() string
type TransactionsMessage ¶
type TransactionsMessage struct {
RawTxs [][]byte
}
TransactionsMessage notify new txs msg
func NewTransactionsMessage ¶
func NewTransactionsMessage(txs []*types.Tx) (*TransactionsMessage, error)
NewTransactionsMessage construct notify new txs msg
func (*TransactionsMessage) GetTransactions ¶
func (m *TransactionsMessage) GetTransactions() ([]*types.Tx, error)
GetTransactions get txs from msg
func (*TransactionsMessage) String ¶
func (m *TransactionsMessage) String() string