aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/app.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-15 11:17:59 +0800
committerWei-Ning Huang <aitjcize@gmail.com>2018-10-15 11:17:59 +0800
commit52d490fa7e6b108f71ffb8937554141d5c668ff1 (patch)
tree832567efb84766fafe67c2f83dd24e6c20e8a746 /simulation/app.go
parentc59b65f22bcd61b10c654ee784d6b8bef9fd3bca (diff)
downloaddexon-consensus-52d490fa7e6b108f71ffb8937554141d5c668ff1.tar
dexon-consensus-52d490fa7e6b108f71ffb8937554141d5c668ff1.tar.gz
dexon-consensus-52d490fa7e6b108f71ffb8937554141d5c668ff1.tar.bz2
dexon-consensus-52d490fa7e6b108f71ffb8937554141d5c668ff1.tar.lz
dexon-consensus-52d490fa7e6b108f71ffb8937554141d5c668ff1.tar.xz
dexon-consensus-52d490fa7e6b108f71ffb8937554141d5c668ff1.tar.zst
dexon-consensus-52d490fa7e6b108f71ffb8937554141d5c668ff1.zip
core: fix simulation error (#201)
* Sync dMoment for all consensus core * App check for randomness ignore round 0
Diffstat (limited to 'simulation/app.go')
-rw-r--r--simulation/app.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/simulation/app.go b/simulation/app.go
index 0ca65c9..16bb63a 100644
--- a/simulation/app.go
+++ b/simulation/app.go
@@ -132,7 +132,14 @@ func (a *simApp) TotalOrderingDelivered(blockHashes common.Hashes, early bool) {
// BlockDelivered is called when a block in compaction chain is delivered.
func (a *simApp) BlockDelivered(
blockHash common.Hash, result types.FinalizationResult) {
- if len(result.Randomness) == 0 {
+ if len(result.Randomness) == 0 && func() bool {
+ if block, exist := a.blockByHash[blockHash]; exist {
+ if block.Position.Round == 0 {
+ return false
+ }
+ }
+ return true
+ }() {
panic(fmt.Errorf("Block %s randomness is empty", blockHash))
}
func() {