dbft

package
v0.0.0-...-2cf7c70 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ContextVersion uint32 = 0

Variables

Functions

This section is empty.

Types

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        Uint256
	Height          uint32
	ViewNumber      byte
	BookKeepers     []*crypto.PubKey
	NextBookKeepers []*crypto.PubKey
	Owner           *crypto.PubKey
	BookKeeperIndex int
	PrimaryIndex    uint32
	Timestamp       int64
	Nonce           uint64
	NextBookKeeper  Uint160
	Transactions    []*tx.Transaction
	Signatures      [][]byte
	ExpectedView    []byte
	// contains filtered or unexported fields
}

func NewConsensusContext

func NewConsensusContext() *ConsensusContext

func (*ConsensusContext) ChangeView

func (cxt *ConsensusContext) ChangeView(viewNum byte)

func (*ConsensusContext) GetSignaturesCount

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

func (*ConsensusContext) GetStateDetail

func (cxt *ConsensusContext) GetStateDetail() string

func (*ConsensusContext) M

func (cxt *ConsensusContext) M() int

func (*ConsensusContext) MakeChangeView

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

func (*ConsensusContext) MakeHeader

func (cxt *ConsensusContext) MakeHeader() *ledger.Block

func (*ConsensusContext) MakePayload

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

func (*ConsensusContext) MakePrepareRequest

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

func (*ConsensusContext) MakePrepareResponse

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

func (*ConsensusContext) Reset

func (cxt *ConsensusContext) Reset(client cl.Wallet, localNode protocol.Noder)

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
)

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 {
	Client cl.Wallet
	// contains filtered or unexported fields
}

func NewDbftService

func NewDbftService(client cl.Wallet, logDictionary string, localNet protocol.Noder) *DbftService

func (*DbftService) BlockPersistCompleted

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

func (*DbftService) ChangeViewReceived

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

func (*DbftService) CheckExpectedView

func (ds *DbftService) CheckExpectedView(viewNumber byte)

func (*DbftService) CheckPolicy

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

func (*DbftService) CheckSignatures

func (ds *DbftService) CheckSignatures() error

func (*DbftService) ConsensusMsgReceived

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

func (*DbftService) CreateCoinbaseTransaction

func (ds *DbftService) CreateCoinbaseTransaction(nonce uint64) *tx.Transaction

func (*DbftService) GetUnverifiedTxs

func (ds *DbftService) GetUnverifiedTxs(txs []*tx.Transaction) []*tx.Transaction

func (*DbftService) Halt

func (ds *DbftService) Halt() error

func (*DbftService) InitializeConsensus

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

func (*DbftService) NewConsensusPayload

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

func (*DbftService) PrepareRequestReceived

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

func (*DbftService) PrepareResponseReceived

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

func (*DbftService) RequestChangeView

func (ds *DbftService) RequestChangeView()

func (*DbftService) SignAndRelay

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

func (*DbftService) Start

func (ds *DbftService) Start() error

func (*DbftService) Timeout

func (ds *DbftService) Timeout()

func (*DbftService) VerifyTxs

func (ds *DbftService) VerifyTxs(txs []*tx.Transaction) error

type PrepareRequest

type PrepareRequest struct {
	Nonce          uint64
	NextBookKeeper Uint160
	Transactions   []*tx.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

Jump to

Keyboard shortcuts

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