aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-10-02 17:21:00 +0800
committerGitHub <noreply@github.com>2018-10-02 17:21:00 +0800
commita6e8ee4d4800a1978eb474a01091f83937743718 (patch)
tree4422790e1c739d7fb9e10e107982f67e1b743e7a /core/consensus.go
parentd34f6b070e7361fcb582350ad8faf6148e82042e (diff)
downloaddexon-consensus-a6e8ee4d4800a1978eb474a01091f83937743718.tar
dexon-consensus-a6e8ee4d4800a1978eb474a01091f83937743718.tar.gz
dexon-consensus-a6e8ee4d4800a1978eb474a01091f83937743718.tar.bz2
dexon-consensus-a6e8ee4d4800a1978eb474a01091f83937743718.tar.lz
dexon-consensus-a6e8ee4d4800a1978eb474a01091f83937743718.tar.xz
dexon-consensus-a6e8ee4d4800a1978eb474a01091f83937743718.tar.zst
dexon-consensus-a6e8ee4d4800a1978eb474a01091f83937743718.zip
core: remove shard (#161)
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/consensus.go b/core/consensus.go
index e7b5ec7..6cc0937 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -48,7 +48,7 @@ var (
// consensusBAReceiver implements agreementReceiver.
type consensusBAReceiver struct {
- // TODO(mission): consensus would be replaced by shard and network.
+ // TODO(mission): consensus would be replaced by lattice and network.
consensus *Consensus
agreementModule *agreement
chainID uint32
@@ -169,8 +169,8 @@ type Consensus struct {
cfgModule *configurationChain
// Dexon consensus v1's modules.
- shardModule *Shard
- ccModule *compactionChain
+ lattice *Lattice
+ ccModule *compactionChain
// Interfaces.
db blockdb.BlockDatabase
@@ -198,7 +198,7 @@ func NewConsensus(
var round uint64
config := gov.Configuration(round)
// TODO(w): notarySet is different for each chain, need to write a
- // GetNotarySetForChain(nodeSet, shardID, chainID, crs) function to get the
+ // GetNotarySetForChain(nodeSet, chainID, crs) function to get the
// correct notary set for a given chain.
nodeSetCache := NewNodeSetCache(gov)
crs := gov.CRS(round)
@@ -215,8 +215,8 @@ func NewConsensus(
debugApp, _ := app.(Debug)
// Setup nonblocking module.
nbModule := newNonBlocking(app, debugApp)
- // Init shard.
- shardModule := NewShard(config, authModule, nbModule, nbModule, db)
+ // Init lattice.
+ lattice := NewLattice(config, authModule, nbModule, nbModule, db)
// Init configuration chain.
ID := types.NewNodeID(prv.PublicKey())
cfgModule := newConfigurationChain(
@@ -237,7 +237,7 @@ func NewConsensus(
ID: ID,
currentConfig: config,
ccModule: newCompactionChain(db),
- shardModule: shardModule,
+ lattice: lattice,
nbModule: nbModule,
gov: gov,
db: db,
@@ -335,7 +335,7 @@ BALoop:
nIDs = nodes.GetSubSet(con.gov.Configuration(con.round).NumNotarySet,
types.NewNotarySetTarget(con.gov.CRS(con.round), chainID))
}
- agreement.restart(nIDs, con.shardModule.NextPosition(chainID))
+ agreement.restart(nIDs, con.lattice.NextPosition(chainID))
default:
}
err := agreement.nextState()
@@ -498,7 +498,7 @@ func (con *Consensus) ProcessVote(vote *types.Vote) (err error) {
// preProcessBlock performs Byzantine Agreement on the block.
func (con *Consensus) preProcessBlock(b *types.Block) (err error) {
- if err = con.shardModule.SanityCheck(b); err != nil {
+ if err = con.lattice.SanityCheck(b); err != nil {
return
}
if err = con.baModules[b.Position.ChainID].processBlock(b); err != nil {
@@ -509,7 +509,7 @@ func (con *Consensus) preProcessBlock(b *types.Block) (err error) {
// processBlock is the entry point to submit one block to a Consensus instance.
func (con *Consensus) processBlock(block *types.Block) (err error) {
- verifiedBlocks, deliveredBlocks, err := con.shardModule.ProcessBlock(block)
+ verifiedBlocks, deliveredBlocks, err := con.lattice.ProcessBlock(block)
if err != nil {
return
}
@@ -540,7 +540,7 @@ func (con *Consensus) processBlock(block *types.Block) (err error) {
// PrepareBlock would setup header fields of block based on its ProposerID.
func (con *Consensus) prepareBlock(b *types.Block,
proposeTime time.Time) (err error) {
- if err = con.shardModule.PrepareBlock(b, proposeTime); err != nil {
+ if err = con.lattice.PrepareBlock(b, proposeTime); err != nil {
return
}
// TODO(mission): decide CRS by block's round, which could be determined by