pbft

package
v0.0.0-...-5fa8bf8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatherAndSend

func GatherAndSend(nodeID int, pl *log.Logger)

func MergeAndBroadcast

func MergeAndBroadcast(t MessageType, data []byte, from string, to []string, logger *log.Logger)

func MergeAndSend

func MergeAndSend(t MessageType, content []byte, addr string, logger *log.Logger)

func MergeMessage

func MergeMessage(msgType MessageType, content []byte) []byte

func PrintBlockChain

func PrintBlockChain(bc *chain.BlockChain) string

Types

type BlockInfoMsg

type BlockInfoMsg struct {
	BlockBodyLength int
	ExcutedTxs      []*base.Transaction
	Epoch           int

	ProposeTime time.Time
	CommitTime  time.Time

	TxpoolSize int
}

type BookingMsg

type BookingMsg struct {
	AvgCpuTime    float64 `json:"avgCpuTime"`
	DiskMetric    uint64  `json:"disk"`
	TotalUpload   int     `json:"tu"`
	TotalDownload int     `json:"td"`
	TotalTime     int64   `json:"tm"`
	NodeId        int     `json:"nodeid"`
}

type Commit

type Commit struct {
	Digest     []byte
	SeqID      uint64
	SenderNode *Node
}

type ConsensusNode

type ConsensusNode struct {
	RunningNode *Node
	NodeID      uint64

	CurChain *chain.BlockChain
	// contains filtered or unexported fields
}

func NewPbftNode

func NewPbftNode(nodeID uint64, pcc *chain.Config) *ConsensusNode

func (*ConsensusNode) Run

func (self *ConsensusNode) Run()

type InjectTxs

type InjectTxs struct {
	Txs []*base.Transaction
}

type KeepAliveMsg

type KeepAliveMsg struct {
	Msg string `json:"msg"`
}

type MessageType

type MessageType string
const (
	CPrePrepare        MessageType = "preprepare"
	CPrepare           MessageType = "prepare"
	CCommit            MessageType = "commit"
	CRequestOldrequest MessageType = "requestOldrequest"
	CStop              MessageType = "stop"

	CPbft   MessageType = "pbft"
	CInject MessageType = "inject"

	CBlockInfo MessageType = "BlockInfo"
	CSeqIDinfo MessageType = "SequenceID"
	CBooking   MessageType = "Booking"

	CKeepAlive MessageType = "KeepAlive"
)

func SplitMessage

func SplitMessage(message []byte) (MessageType, []byte)

type Node

type Node struct {
	NodeID uint64
	IPaddr string
}

func (*Node) PrintNode

func (n *Node) PrintNode()

type PbftImplInterface

type PbftImplInterface interface {
	// contains filtered or unexported methods
}

type PbftImplSimpleImpl

type PbftImplSimpleImpl struct {
	// contains filtered or unexported fields
}

type PrePrepare

type PrePrepare struct {
	RequestMsg *Request
	Digest     []byte
	SeqID      uint64
}

type Prepare

type Prepare struct {
	Digest     []byte
	SeqID      uint64
	SenderNode *Node
}

type RawMessage

type RawMessage struct {
	Content []byte
}

type Reply

type Reply struct {
	MessageID  uint64
	SenderNode *Node
	Result     bool
}

type Request

type Request struct {
	RequestType RequestType
	Msg         RawMessage
	ReqTime     time.Time
}

type RequestOldMessage

type RequestOldMessage struct {
	SeqStartHeight uint64
	SeqEndHeight   uint64
	ServerNode     *Node
	SenderNode     *Node
}

type RequestType

type RequestType string
var (
	BlockRequest RequestType = "Block"
)

type SeqIDinfo

type SeqIDinfo struct {
	SenderSeq uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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