pbftTypes

package
v0.0.0-...-215cb89 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2020 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RequestInfo    uint8 = 0
	ResponseInfo   uint8 = 1
	CommitInfo     uint8 = 2
	ViewChangeInfo uint8 = 3

	RequestUrl    string = "/pbft/request"
	ResponseUrl   string = "/pbft/response"
	CommitUrl     string = "/pbft/commit"
	ViewChangeUrl string = "/pbft/viewChange"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	InfoID    uint8
	NodeID    uint64
	ViewID    uint64
	BlockHash *types.Hash
	Signature *types.Signature
}

func JsonToCommit

func JsonToCommit(cmtJson []byte) *Commit

func NewCommit

func NewCommit(nodeID uint64, viewID uint64, blockHash *types.Hash) *Commit

func (*Commit) Bytes

func (cmt *Commit) Bytes() []byte

func (*Commit) CalcHash

func (cmt *Commit) CalcHash() *types.Hash

func (*Commit) CheckSignature

func (cmt *Commit) CheckSignature() bool

func (*Commit) ToJson

func (cmt *Commit) ToJson() []byte

type Request

type Request struct {
	InfoID    uint8
	NodeID    uint64
	ViewID    uint64
	BlockJson []byte
	Signature *types.Signature
}

func BytesToRequest

func BytesToRequest(b []byte) *Request

func NewRequest

func NewRequest(nodeID uint64, viewID uint64, blockJson []byte) *Request

func (*Request) Bytes

func (req *Request) Bytes() []byte

func (*Request) CalcHash

func (req *Request) CalcHash() *types.Hash

func (*Request) CheckSignature

func (req *Request) CheckSignature() (bool, error)

func (*Request) Sign

func (req *Request) Sign(signature *types.Signature)

func (*Request) ToJson

func (req *Request) ToJson() []byte

type Response

type Response struct {
	InfoID    uint8
	NodeID    uint64
	ViewID    uint64
	BlockHash types.Hash
	Signature *types.Signature
}

func NewResponse

func NewResponse(nodeID uint64, viewID uint64, blockHash types.Hash) *Response

func (*Response) Bytes

func (resp *Response) Bytes() []byte

func (*Response) CalcHash

func (resp *Response) CalcHash() *types.Hash

func (*Response) CheckSignature

func (resp *Response) CheckSignature() (bool, error)

func (*Response) ToJson

func (resp *Response) ToJson() []byte

type ViewChange

type ViewChange struct {
	InfoID    uint8
	NodeID    uint64
	ViewID    uint64
	NewViewID uint64
	Signature *types.Signature
}

func NewViewChange

func NewViewChange(nodeID uint64, viewID uint64, newViewID uint64) *ViewChange

func (*ViewChange) Bytes

func (vc *ViewChange) Bytes() []byte

func (*ViewChange) CalcHash

func (vc *ViewChange) CalcHash() *types.Hash

func (*ViewChange) CheckSignature

func (vc *ViewChange) CheckSignature() (bool, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL