dbft

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2018 License: LGPL-3.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ContextVersion uint32 = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockSignatures

type BlockSignatures struct {
	Signatures []SignaturesData
	// contains filtered or unexported fields
}

func (*BlockSignatures) ConsensusMessageData

func (self *BlockSignatures) ConsensusMessageData() *ConsensusMessageData

func (*BlockSignatures) Deserialize

func (self *BlockSignatures) Deserialize(r io.Reader) error

func (*BlockSignatures) Serialize

func (self *BlockSignatures) Serialize(w io.Writer) error

func (*BlockSignatures) Type

func (*BlockSignatures) ViewNumber

func (self *BlockSignatures) ViewNumber() byte

type ChangeView

type ChangeView struct {
	NewViewNumber byte
	// contains filtered or unexported fields
}

func (*ChangeView) ConsensusMessageData

func (cv *ChangeView) ConsensusMessageData() *ConsensusMessageData

func (*ChangeView) Deserialize

func (cv *ChangeView) Deserialize(r io.Reader) error

read data to reader

func (*ChangeView) Serialize

func (cv *ChangeView) Serialize(w io.Writer) error

func (*ChangeView) Type

func (cv *ChangeView) Type() ConsensusMessageType

func (*ChangeView) ViewNumber

func (cv *ChangeView) ViewNumber() byte

type ConsensusContext

type ConsensusContext struct {
	State           ConsensusState
	PrevHash        common.Uint256
	Height          uint32
	ViewNumber      byte
	Bookkeepers     []keypair.PublicKey
	NextBookkeepers []keypair.PublicKey
	Owner           keypair.PublicKey
	BookkeeperIndex int
	PrimaryIndex    uint32
	Timestamp       uint32
	Nonce           uint64
	NextBookkeeper  common.Address
	Transactions    []*types.Transaction
	Signatures      [][]byte
	ExpectedView    []byte
	// contains filtered or unexported fields
}

func NewConsensusContext

func NewConsensusContext() *ConsensusContext

func (*ConsensusContext) ChangeView

func (ctx *ConsensusContext) ChangeView(viewNum byte)

func (*ConsensusContext) GetSignaturesCount

func (ctx *ConsensusContext) GetSignaturesCount() (count int)

func (*ConsensusContext) GetStateDetail

func (ctx *ConsensusContext) GetStateDetail() string

func (*ConsensusContext) M

func (ctx *ConsensusContext) M() int

func (*ConsensusContext) MakeBlockSignatures

func (ctx *ConsensusContext) MakeBlockSignatures(signatures []SignaturesData) *msg.ConsensusPayload

func (*ConsensusContext) MakeChangeView

func (ctx *ConsensusContext) MakeChangeView() *msg.ConsensusPayload

func (*ConsensusContext) MakeHeader

func (ctx *ConsensusContext) MakeHeader() *types.Block

func (*ConsensusContext) MakePayload

func (ctx *ConsensusContext) MakePayload(message ConsensusMessage) *msg.ConsensusPayload

func (*ConsensusContext) MakePrepareRequest

func (ctx *ConsensusContext) MakePrepareRequest() *msg.ConsensusPayload

func (*ConsensusContext) MakePrepareResponse

func (ctx *ConsensusContext) MakePrepareResponse(signature []byte) *msg.ConsensusPayload

func (*ConsensusContext) Reset

func (ctx *ConsensusContext) Reset(bkAccount *account.Account)

type ConsensusMessage

type ConsensusMessage interface {
	ser.SerializableData
	Type() ConsensusMessageType
	ViewNumber() byte
	ConsensusMessageData() *ConsensusMessageData
}

func DeserializeMessage

func DeserializeMessage(data []byte) (ConsensusMessage, error)

type ConsensusMessageData

type ConsensusMessageData struct {
	Type       ConsensusMessageType
	ViewNumber byte
}

func (*ConsensusMessageData) Deserialize

func (cd *ConsensusMessageData) Deserialize(r io.Reader) error

read data to reader

func (*ConsensusMessageData) Serialize

func (cd *ConsensusMessageData) Serialize(w io.Writer)

type ConsensusMessageType

type ConsensusMessageType byte
const (
	ChangeViewMsg      ConsensusMessageType = 0x00
	PrepareRequestMsg  ConsensusMessageType = 0x20
	PrepareResponseMsg ConsensusMessageType = 0x21
	BlockSignaturesMsg ConsensusMessageType = 0x01
)

type ConsensusState

type ConsensusState byte
const (
	Initial         ConsensusState = 0x00
	Primary         ConsensusState = 0x01
	Backup          ConsensusState = 0x02
	RequestSent     ConsensusState = 0x04
	RequestReceived ConsensusState = 0x08
	SignatureSent   ConsensusState = 0x10
	BlockGenerated  ConsensusState = 0x20
)

func (ConsensusState) HasFlag

func (state ConsensusState) HasFlag(flag ConsensusState) bool

type DbftService

type DbftService struct {
	Account *account.Account
	// contains filtered or unexported fields
}

func NewDbftService

func NewDbftService(bkAccount *account.Account, txpool, p2p *actor.PID) (*DbftService, error)

func (*DbftService) BlockPersistCompleted

func (ds *DbftService) BlockPersistCompleted(v interface{})

func (*DbftService) BlockSignaturesReceived

func (ds *DbftService) BlockSignaturesReceived(payload *p2pmsg.ConsensusPayload, message *BlockSignatures)

func (*DbftService) ChangeViewReceived

func (ds *DbftService) ChangeViewReceived(payload *p2pmsg.ConsensusPayload, message *ChangeView)

func (*DbftService) CheckExpectedView

func (ds *DbftService) CheckExpectedView(viewNumber byte)

func (*DbftService) CheckPolicy

func (ds *DbftService) CheckPolicy(transaction *types.Transaction) error

func (*DbftService) CheckSignatures

func (ds *DbftService) CheckSignatures() error

func (*DbftService) GetPID

func (this *DbftService) GetPID() *actor.PID

func (*DbftService) Halt

func (this *DbftService) Halt() error

func (*DbftService) InitializeConsensus

func (ds *DbftService) InitializeConsensus(viewNum byte) error

func (*DbftService) LocalNodeNewInventory

func (ds *DbftService) LocalNodeNewInventory(v interface{})

func (*DbftService) NewConsensusPayload

func (ds *DbftService) NewConsensusPayload(payload *p2pmsg.ConsensusPayload)

func (*DbftService) PrepareRequestReceived

func (ds *DbftService) PrepareRequestReceived(payload *p2pmsg.ConsensusPayload, message *PrepareRequest)

func (*DbftService) PrepareResponseReceived

func (ds *DbftService) PrepareResponseReceived(payload *p2pmsg.ConsensusPayload, message *PrepareResponse)

func (*DbftService) Receive

func (this *DbftService) Receive(context actor.Context)

func (*DbftService) RefreshPolicy

func (ds *DbftService) RefreshPolicy()

func (*DbftService) RequestChangeView

func (ds *DbftService) RequestChangeView()

func (*DbftService) SignAndRelay

func (ds *DbftService) SignAndRelay(payload *p2pmsg.ConsensusPayload)

func (*DbftService) Start

func (this *DbftService) Start() error

func (*DbftService) Timeout

func (ds *DbftService) Timeout()

type PrepareRequest

type PrepareRequest struct {
	Nonce          uint64
	NextBookkeeper common.Address
	Transactions   []*types.Transaction
	Signature      []byte
	// contains filtered or unexported fields
}

func (*PrepareRequest) ConsensusMessageData

func (pr *PrepareRequest) ConsensusMessageData() *ConsensusMessageData

func (*PrepareRequest) Deserialize

func (pr *PrepareRequest) Deserialize(r io.Reader) error

func (*PrepareRequest) Serialize

func (pr *PrepareRequest) Serialize(w io.Writer) error

func (*PrepareRequest) Type

func (*PrepareRequest) ViewNumber

func (pr *PrepareRequest) ViewNumber() byte

type PrepareResponse

type PrepareResponse struct {
	Signature []byte
	// contains filtered or unexported fields
}

func (*PrepareResponse) ConsensusMessageData

func (pres *PrepareResponse) ConsensusMessageData() *ConsensusMessageData

func (*PrepareResponse) Deserialize

func (pres *PrepareResponse) Deserialize(r io.Reader) error

read data to reader

func (*PrepareResponse) Serialize

func (pres *PrepareResponse) Serialize(w io.Writer) error

func (*PrepareResponse) Type

func (*PrepareResponse) ViewNumber

func (pres *PrepareResponse) ViewNumber() byte

type SignaturesData

type SignaturesData struct {
	Signature []byte
	Index     uint16
}

Jump to

Keyboard shortcuts

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