Documentation ¶
Index ¶
- Constants
- Variables
- func GetHeadersFromHash(startHash Uint256, stopHash Uint256) ([]ledger.Header, uint32, error)
- func HandleNodeMsg(node Noder, buf []byte, len int) error
- func MsgType(buf []byte) (string, error)
- func NewAddrs(nodeaddrs []NodeAddr, count uint64) ([]byte, error)
- func NewBlock(bk *ledger.Block) ([]byte, error)
- func NewBlockFromHash(hash common.Uint256) (*ledger.Block, error)
- func NewBlocksReq(n Noder) ([]byte, error)
- func NewConsensus(cp *ConsensusPayload) ([]byte, error)
- func NewHeaders(headers []ledger.Header, count uint32) ([]byte, error)
- func NewHeadersReq(stopHash Uint256) ([]byte, error)
- func NewInv(inv *InvPayload) ([]byte, error)
- func NewIsingConsensus(pld *IsingPayload) ([]byte, error)
- func NewMsg(t string, n Noder) ([]byte, error)
- func NewNotFound(hash common.Uint256) ([]byte, error)
- func NewPingMsg(state SyncState) ([]byte, error)
- func NewPongMsg(state SyncState) ([]byte, error)
- func NewTxn(txn *transaction.Transaction) ([]byte, error)
- func NewTxnFromHash(hash common.Uint256) (*transaction.Transaction, error)
- func NewVerack() ([]byte, error)
- func NewVersion(n Noder) ([]byte, error)
- func PayloadLen(buf []byte) int
- func ReqBlkData(node Noder, hash common.Uint256) error
- func ReqTxnPool(node Noder) error
- func SendMsgSyncHeaders(node Noder, stopHash Uint256)
- func ValidMsgHdr(buf []byte) bool
- type ConsensusPayload
- func (cp *ConsensusPayload) Deserialize(r io.Reader) error
- func (cp *ConsensusPayload) DeserializeUnsigned(r io.Reader) error
- func (cp *ConsensusPayload) GetMessage() []byte
- func (cp *ConsensusPayload) GetProgramHashes() ([]common.Uint160, error)
- func (cp *ConsensusPayload) GetPrograms() []*program.Program
- func (cp *ConsensusPayload) Serialize(w io.Writer) error
- func (cp *ConsensusPayload) SerializeUnsigned(w io.Writer) error
- func (cp *ConsensusPayload) SetPrograms(programs []*program.Program)
- func (b *ConsensusPayload) ToArray() []byte
- type Inv
- type InvPayload
- type IsingMessage
- type IsingPayload
- type Messager
- type NotifyInfo
- type RelayMessage
- type RelayPacket
Constants ¶
View Source
const ( MsgHdrLen = 24 MsgCmdLen = 12 MsgCmdOffset = 4 MsgChecksumLen = 4 NetID = 0x00000000 MaxHdrCnt = 500 MaxInvHdrCnt = 500 HashLen = 32 )
View Source
const (
HTTPINFOFLAG = 0
)
Variables ¶
View Source
var LastInvHash Uint256
Functions ¶
func GetHeadersFromHash ¶
func HandleNodeMsg ¶
FIXME the length exceed int32 case?
func NewBlocksReq ¶
func NewConsensus ¶
func NewConsensus(cp *ConsensusPayload) ([]byte, error)
func NewHeadersReq ¶
func NewInv ¶
func NewInv(inv *InvPayload) ([]byte, error)
func NewIsingConsensus ¶
func NewIsingConsensus(pld *IsingPayload) ([]byte, error)
func NewPingMsg ¶
func NewPongMsg ¶
func NewTxn ¶
func NewTxn(txn *transaction.Transaction) ([]byte, error)
func NewTxnFromHash ¶
func NewTxnFromHash(hash common.Uint256) (*transaction.Transaction, error)
func NewVersion ¶
func PayloadLen ¶
func ReqBlkData ¶
func ReqTxnPool ¶
func ReqTxnPool(node Noder) error
func SendMsgSyncHeaders ¶
func SendMsgSyncHeaders(node Noder, stopHash Uint256)
func ValidMsgHdr ¶
Types ¶
type ConsensusPayload ¶
type ConsensusPayload struct { Version uint32 PrevHash common.Uint256 Height uint32 BookKeeperIndex uint16 Timestamp int64 Data []byte Owner *crypto.PubKey Program *program.Program // contains filtered or unexported fields }
func (*ConsensusPayload) Deserialize ¶
func (cp *ConsensusPayload) Deserialize(r io.Reader) error
func (*ConsensusPayload) DeserializeUnsigned ¶
func (cp *ConsensusPayload) DeserializeUnsigned(r io.Reader) error
func (*ConsensusPayload) GetMessage ¶
func (cp *ConsensusPayload) GetMessage() []byte
func (*ConsensusPayload) GetProgramHashes ¶
func (cp *ConsensusPayload) GetProgramHashes() ([]common.Uint160, error)
func (*ConsensusPayload) GetPrograms ¶
func (cp *ConsensusPayload) GetPrograms() []*program.Program
func (*ConsensusPayload) SerializeUnsigned ¶
func (cp *ConsensusPayload) SerializeUnsigned(w io.Writer) error
func (*ConsensusPayload) SetPrograms ¶
func (cp *ConsensusPayload) SetPrograms(programs []*program.Program)
func (*ConsensusPayload) ToArray ¶
func (b *ConsensusPayload) ToArray() []byte
type Inv ¶
type Inv struct { Hdr msgHdr P InvPayload }
type InvPayload ¶
func GetInvFromBlockHash ¶
func GetInvFromBlockHash(starthash Uint256, stophash Uint256) (*InvPayload, error)
func NewInvPayload ¶
func NewInvPayload(invType InventoryType, count uint32, msg []byte) *InvPayload
type IsingMessage ¶
type IsingMessage struct {
// contains filtered or unexported fields
}
func (*IsingMessage) Deserialize ¶
func (p *IsingMessage) Deserialize(r io.Reader) error
func (IsingMessage) Handle ¶
func (msg IsingMessage) Handle(node Noder) error
type IsingPayload ¶
func (*IsingPayload) DataHash ¶
func (p *IsingPayload) DataHash() ([]byte, error)
func (*IsingPayload) Deserialize ¶
func (p *IsingPayload) Deserialize(r io.Reader) error
func (*IsingPayload) DeserializeUnsigned ¶
func (p *IsingPayload) DeserializeUnsigned(r io.Reader) error
func (*IsingPayload) SerializeUnsigned ¶
func (p *IsingPayload) SerializeUnsigned(w io.Writer) error
type Messager ¶
type Messager interface { Verify([]byte) error Handle(Noder) error serialization.SerializableData }
type NotifyInfo ¶
type NotifyInfo struct { Payload *IsingPayload SenderID uint64 }
type RelayMessage ¶
type RelayMessage struct {
// contains filtered or unexported fields
}
func NewRelayMessage ¶
func NewRelayMessage(packet *RelayPacket) (*RelayMessage, error)
func (*RelayMessage) Deserialize ¶
func (msg *RelayMessage) Deserialize(r io.Reader) error
func (*RelayMessage) ToBytes ¶
func (msg *RelayMessage) ToBytes() ([]byte, error)
type RelayPacket ¶
type RelayPacket struct { SrcAddr string DestID []byte Payload []byte SigChain *por.SigChain MaxHoldingSeconds uint32 }
func NewRelayPacket ¶
func (*RelayPacket) Deserialize ¶
func (packet *RelayPacket) Deserialize(r io.Reader) error
Click to show internal directories.
Click to hide internal directories.