diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-10-05 09:12:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-05 09:12:26 +0800 |
commit | efcb301ec31acf7b87312cbec962682148555999 (patch) | |
tree | 76ba2fbe5a7c7017005f771ab95102b997973f1f /core/consensus.go | |
parent | 6773c56fe29511aca0f4345e9fd3758ca05e174f (diff) | |
download | dexon-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.go | 5 |
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 } |