aboutsummaryrefslogtreecommitdiffstats
path: root/core/lattice.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-12-26 15:23:54 +0800
committerGitHub <noreply@github.com>2018-12-26 15:23:54 +0800
commit39c02fe0f7c81491ea897fafcf32595d280bbdbe (patch)
tree1ac3d002de42bb7471624656713e331db55aaea2 /core/lattice.go
parent00416c9df2fec5398389863fb6f885a1fe11a6cc (diff)
downloaddexon-consensus-39c02fe0f7c81491ea897fafcf32595d280bbdbe.tar
dexon-consensus-39c02fe0f7c81491ea897fafcf32595d280bbdbe.tar.gz
dexon-consensus-39c02fe0f7c81491ea897fafcf32595d280bbdbe.tar.bz2
dexon-consensus-39c02fe0f7c81491ea897fafcf32595d280bbdbe.tar.lz
dexon-consensus-39c02fe0f7c81491ea897fafcf32595d280bbdbe.tar.xz
dexon-consensus-39c02fe0f7c81491ea897fafcf32595d280bbdbe.tar.zst
dexon-consensus-39c02fe0f7c81491ea897fafcf32595d280bbdbe.zip
core: fix stuffs (#383)
* Merge core.Consensus constructors * Downgrade severity of logs * Refine logic to add blocks from pool to lattice * Add test.LaunchDummyReceiver
Diffstat (limited to 'core/lattice.go')
-rw-r--r--core/lattice.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/lattice.go b/core/lattice.go
index db19cf9..591c63d 100644
--- a/core/lattice.go
+++ b/core/lattice.go
@@ -193,17 +193,28 @@ func (l *Lattice) addBlockToLattice(
if err == nil {
var output []*types.Block
if output, err = l.data.addBlock(tip); err != nil {
- l.logger.Error("Sanity Check failed", "error", err)
- continue
+ // We should be able to add this block once sanity check
+ // passed.
+ l.logger.Error("Failed to add sanity-checked block",
+ "block", tip, "error", err)
+ panic(err)
}
hasOutput = true
outputBlocks = append(outputBlocks, output...)
+ l.pool.removeTip(i)
+ continue
}
if _, ok := err.(*ErrAckingBlockNotExists); ok {
+ l.logger.Debug("Pending block for lattice",
+ "pending", tip,
+ "last", l.data.chains[tip.Position.ChainID])
err = nil
continue
+ } else {
+ l.logger.Error("Unexpected sanity check error",
+ "block", tip, "error", err)
+ panic(err)
}
- l.pool.removeTip(i)
}
if !hasOutput {
break