monologue

package
v0.0.0-...-667e438 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

MONOGUE Consensus

MONOGUE is the simplest consensus implement, like the "noops" in fabric-0.6. It suppose only one node is selected for determinding a single block, and any other nodes join in this consensus will admit it.

Mutiple nodes can appoint one of them for responding one blocks via some external consensus progress (such as an election in etcd), to avoid single-point failure. So there may be mutiple candidates for a single block but before any next candidate is delivered, every node must admit one of them, and the hash of the admited block is just the previous hash field in all of the next candidates. As the result, there will be always one-block lag for each transaction being added onto the chain

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfirm

func BuildConfirm(ccName string, proposalC chan<- framework.ProposalTask,
	deliver framework.ConsensusTxDeliver) func(uint64, []byte)

monologue will "hide" its lastest block but a miner require it to be able to mine the next one, the latest block is selected external of our module and here is the entry to set the result. A custom mining progress is generated and delivered (so core and states can be accessed without racing cases), the latest block can be poped up from core and delivered to learner, push the state forward, so miner can do mining for the next block. i.e. miner mining on a series of continuous blocks should alternately call mining - confirming - mining the deliver should direct send tx into local learner instead of the tx network, which is provided by framework.baseLearnerImpl

func DefaultWrapper

func DefaultWrapper(ccname string, method string) func([]byte) (*pb.Transaction, error)

default wrapper purpose the generated tx is applied on the monologueCC (which should be a system cc) directly

func NewChaincode

func NewChaincode(core *ConsensusCore, notify func(*cspb.PurposeBlock)) monologueCC

func NewMiner

func NewMiner(wrapper func([]byte) (*pb.Transaction, error)) *miner

Types

type ConsensusCore

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

func NewCore

func NewCore(candidateSize int) *ConsensusCore

func (*ConsensusCore) ConsensusInput

func (cc *ConsensusCore) ConsensusInput(pblk *cspb.PurposeBlock) (ret *cspb.ConsensusOutput)

monologue directly output the results

func (*ConsensusCore) Tip

func (cc *ConsensusCore) Tip(n uint64, hash []byte) (ret *cspb.ConsensusOutput)

allow an additional tip input to "pop up" the candidate block

Jump to

Keyboard shortcuts

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