naive

package
v0.0.0-...-496c6ee Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Sequence     uint64
	PrevHash     string
	Transactions []Transaction
}

type BlockData

type BlockData struct {
	Transactions [][]byte
}

func BlockDataFromBytes

func BlockDataFromBytes(rawBlock []byte) *BlockData

func (BlockData) ToBytes

func (b BlockData) ToBytes() []byte

type BlockHeader

type BlockHeader struct {
	Sequence int64
	PrevHash string
	DataHash string
}

func BlockHeaderFromBytes

func BlockHeaderFromBytes(rawHeader []byte) *BlockHeader

func (BlockHeader) ToBytes

func (header BlockHeader) ToBytes() []byte

type Chain

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

func NewChain

func NewChain(id uint64, in Ingress, out Egress, logger smart.Logger, opts NetworkOptions, testDir string) *Chain

func (*Chain) Listen

func (chain *Chain) Listen() Block

func (*Chain) Order

func (chain *Chain) Order(txn Transaction) error

type Egress

type Egress map[int]chan<- proto.Message

type FwdMessage

type FwdMessage struct {
	Sender               uint64   `protobuf:"varint,1,opt,name=sender,proto3" json:"sender,omitempty"`
	Payload              []byte   `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*FwdMessage) Descriptor

func (*FwdMessage) Descriptor() ([]byte, []int)

func (*FwdMessage) GetPayload

func (m *FwdMessage) GetPayload() []byte

func (*FwdMessage) GetSender

func (m *FwdMessage) GetSender() uint64

func (*FwdMessage) ProtoMessage

func (*FwdMessage) ProtoMessage()

func (*FwdMessage) Reset

func (m *FwdMessage) Reset()

func (*FwdMessage) String

func (m *FwdMessage) String() string

func (*FwdMessage) XXX_DiscardUnknown

func (m *FwdMessage) XXX_DiscardUnknown()

func (*FwdMessage) XXX_Marshal

func (m *FwdMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FwdMessage) XXX_Merge

func (m *FwdMessage) XXX_Merge(src proto.Message)

func (*FwdMessage) XXX_Size

func (m *FwdMessage) XXX_Size() int

func (*FwdMessage) XXX_Unmarshal

func (m *FwdMessage) XXX_Unmarshal(b []byte) error

type Ingress

type Ingress map[int]<-chan proto.Message

type NetworkOptions

type NetworkOptions struct {
	NumNodes     int
	BatchSize    int
	BatchTimeout time.Duration
}

type Node

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

func NewNode

func NewNode(id uint64, in Ingress, out Egress, deliverChan chan<- *Block, logger smart.Logger, opts NetworkOptions, testDir string) *Node

func (*Node) AssembleProposal

func (n *Node) AssembleProposal(metadata []byte, requests [][]byte) (nextProp bft.Proposal, remainder [][]byte)

func (*Node) BroadcastConsensus

func (n *Node) BroadcastConsensus(m *smartbftprotos.Message)

func (*Node) Deliver

func (n *Node) Deliver(proposal bft.Proposal, signature []bft.Signature)

func (*Node) Nodes

func (n *Node) Nodes() []uint64

func (*Node) RequestID

func (*Node) RequestID(req []byte) bft.RequestInfo

func (*Node) SendConsensus

func (n *Node) SendConsensus(targetID uint64, message *smartbftprotos.Message)

func (*Node) SendTransaction

func (n *Node) SendTransaction(targetID uint64, request []byte)

func (*Node) Sign

func (*Node) Sign(msg []byte) []byte

func (*Node) SignProposal

func (n *Node) SignProposal(bft.Proposal) *bft.Signature

func (*Node) Start

func (n *Node) Start()

func (*Node) Stop

func (n *Node) Stop()

func (*Node) Sync

func (*Node) VerificationSequence

func (*Node) VerificationSequence() uint64

func (*Node) VerifyConsenterSig

func (*Node) VerifyConsenterSig(_ bft.Signature, prop bft.Proposal) error

func (*Node) VerifyProposal

func (*Node) VerifyProposal(proposal bft.Proposal) ([]bft.RequestInfo, error)

func (*Node) VerifyRequest

func (*Node) VerifyRequest(val []byte) (bft.RequestInfo, error)

func (*Node) VerifySignature

func (*Node) VerifySignature(signature bft.Signature) error

type Transaction

type Transaction struct {
	ClientID string
	Id       string
}

func TransactionFromBytes

func TransactionFromBytes(rawTxn []byte) *Transaction

func (Transaction) ToBytes

func (txn Transaction) ToBytes() []byte

Jump to

Keyboard shortcuts

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