Documentation ¶
Index ¶
- Constants
- func GetBestQC(ctx context.Context, rpc RPC) (*block.QuorumCert, error)
- func GetBlockByID(ctx context.Context, rpc RPC, id meter.Bytes32) (rlp.RawValue, error)
- func GetBlockIDByNumber(ctx context.Context, rpc RPC, num uint32) (meter.Bytes32, error)
- func GetBlocksFromNumber(ctx context.Context, rpc RPC, num uint32) ([]rlp.RawValue, error)
- func GetTxs(ctx context.Context, rpc RPC) (tx.Transactions, error)
- func MsgName(msgCode uint64) string
- func NotifyNewBestQC(ctx context.Context, rpc RPC, qc *block.QuorumCert) error
- func NotifyNewBlock(ctx context.Context, rpc RPC, block *block.Block) error
- func NotifyNewBlockID(ctx context.Context, rpc RPC, id meter.Bytes32) error
- func NotifyNewPowBlock(ctx context.Context, rpc RPC, powBlockInfo *powpool.PowBlockInfo) error
- func NotifyNewTx(ctx context.Context, rpc RPC, tx *tx.Transaction) error
- type RPC
- type Status
- type WireQC
Constants ¶
View Source
const ( Name = "meter" Version uint = 1 Length uint64 = 11 MaxMsgSize = 2 * 1024 * 1024 // max size 2M bytes )
Constants
View Source
const ( MsgGetStatus = iota MsgNewBlockID MsgNewBlock MsgNewTx MsgGetBlockByID MsgGetBlockIDByNumber MsgGetBlocksFromNumber // fetch blocks from given number (including given number) MsgGetTxs MsgNewPowBlock MsgGetBestQC MsgNewBestQC )
Protocol messages of meter
Variables ¶
This section is empty.
Functions ¶
func GetBlockByID ¶
GetBlockByID query block from remote peer by given block ID. It may return nil block even no error.
func GetBlockIDByNumber ¶
GetBlockIDByNumber query block ID from remote peer by given number.
func GetBlocksFromNumber ¶
GetBlocksFromNumber get a batch of blocks starts with num from remote peer.
func NotifyNewBestQC ¶
func NotifyNewBlock ¶
NotifyNewBlock notify new block to remote peer.
func NotifyNewBlockID ¶
NotifyNewBlockID notify new block ID to remote peer.
func NotifyNewPowBlock ¶
NotifyNewPow notify new pow block to remote peer.
func NotifyNewTx ¶
NotifyNewTx notify new tx to remote peer.
Types ¶
type RPC ¶
type RPC interface { Notify(ctx context.Context, msgCode uint64, arg interface{}) error Call(ctx context.Context, msgCode uint64, arg interface{}, result interface{}) error }
RPC defines RPC interface.
type Status ¶
type Status struct { GenesisBlockID meter.Bytes32 SysTimestamp uint64 BestBlockID meter.Bytes32 TotalScore uint64 }
Status result of MsgGetStatus.
type WireQC ¶
type WireQC struct { Magic [4]byte QC *block.QuorumCert }
Click to show internal directories.
Click to hide internal directories.