dbft

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: LGPL-3.0 Imports: 21 Imported by: 6

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) Deserialization added in v1.0.3

func (self *BlockSignatures) Deserialization(source *common.ZeroCopySource) error

func (*BlockSignatures) Serialization added in v1.0.3

func (self *BlockSignatures) Serialization(sink *common.ZeroCopySink)

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) Deserialization added in v1.0.3

func (cv *ChangeView) Deserialization(source *common.ZeroCopySource) error

read data to reader

func (*ChangeView) Serialization added in v1.0.3

func (cv *ChangeView) Serialization(sink *common.ZeroCopySink)

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 {
	Serialization(sink *common.ZeroCopySink)
	Deserialization(source *common.ZeroCopySource) error
	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) Deserialization added in v1.0.3

func (cd *ConsensusMessageData) Deserialization(source *common.ZeroCopySource) error

read data to reader

func (*ConsensusMessageData) Serialization added in v1.0.3

func (cd *ConsensusMessageData) Serialization(sink *common.ZeroCopySink)

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) Deserialization added in v1.0.3

func (pr *PrepareRequest) Deserialization(source *common.ZeroCopySource) error

func (*PrepareRequest) Serialization added in v1.0.3

func (pr *PrepareRequest) Serialization(sink *common.ZeroCopySink)

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) Deserialization added in v1.0.3

func (pres *PrepareResponse) Deserialization(source *common.ZeroCopySource) error

read data to reader

func (*PrepareResponse) Serialization added in v1.0.3

func (pres *PrepareResponse) Serialization(sink *common.ZeroCopySink)

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