aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-10-05 09:12:26 +0800
committerGitHub <noreply@github.com>2018-10-05 09:12:26 +0800
commitefcb301ec31acf7b87312cbec962682148555999 (patch)
tree76ba2fbe5a7c7017005f771ab95102b997973f1f /core/consensus.go
parent6773c56fe29511aca0f4345e9fd3758ca05e174f (diff)
downloaddexon-consensus-efcb301ec31acf7b87312cbec962682148555999.tar
dexon-consensus-efcb301ec31acf7b87312cbec962682148555999.tar.gz
dexon-consensus-efcb301ec31acf7b87312cbec962682148555999.tar.bz2
dexon-consensus-efcb301ec31acf7b87312cbec962682148555999.tar.lz
dexon-consensus-efcb301ec31acf7b87312cbec962682148555999.tar.xz
dexon-consensus-efcb301ec31acf7b87312cbec962682148555999.tar.zst
dexon-consensus-efcb301ec31acf7b87312cbec962682148555999.zip
core: find block in db (#174)
* Make sure block pool is large enough It's safe to use a larger blockPool when the number of chains is smaller. * Construct latticeData via config. * Seek acked blocks in blockdb when unable to find them in memory cache. In previous implementation, we assume our cache in memory is enough to perform DAG's sanity check. However, it's no longer true when the number of chains might be changed between rounds. * Simplify purge. Remove the relation to purge block by chainStatus.
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/consensus.go b/core/consensus.go
index 92990b0..b1615a2 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -533,7 +533,7 @@ func (con *Consensus) processBlock(block *types.Block) (err error) {
if err = con.ccModule.processBlock(b); err != nil {
return
}
- if err = con.db.Update(*b); err != nil {
+ if err = con.db.Put(*b); err != nil {
return
}
go con.event.NotifyTime(b.ConsensusTimestamp)
@@ -543,6 +543,9 @@ func (con *Consensus) processBlock(block *types.Block) (err error) {
// nonBlocking and let them recycle the
// block.
}
+ if err = con.lattice.PurgeBlocks(deliveredBlocks); err != nil {
+ return
+ }
return
}