aboutsummaryrefslogtreecommitdiffstats
path: root/simulation
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-09-04 17:39:05 +0800
committerGitHub <noreply@github.com>2018-09-04 17:39:05 +0800
commit04a63a22a24abaaa91b1d981e6d95260d80dadf4 (patch)
treed8e7335984a1b53f097f00f4e4956112d22aa673 /simulation
parent09393166791785ab6730b1c812b4a4fd07a92293 (diff)
downloaddexon-consensus-04a63a22a24abaaa91b1d981e6d95260d80dadf4.tar
dexon-consensus-04a63a22a24abaaa91b1d981e6d95260d80dadf4.tar.gz
dexon-consensus-04a63a22a24abaaa91b1d981e6d95260d80dadf4.tar.bz2
dexon-consensus-04a63a22a24abaaa91b1d981e6d95260d80dadf4.tar.lz
dexon-consensus-04a63a22a24abaaa91b1d981e6d95260d80dadf4.tar.xz
dexon-consensus-04a63a22a24abaaa91b1d981e6d95260d80dadf4.tar.zst
dexon-consensus-04a63a22a24abaaa91b1d981e6d95260d80dadf4.zip
core: BA-based consensus core. (#93)
Diffstat (limited to 'simulation')
-rw-r--r--simulation/app.go2
-rw-r--r--simulation/tcp-network.go14
-rw-r--r--simulation/verification.go2
3 files changed, 16 insertions, 2 deletions
diff --git a/simulation/app.go b/simulation/app.go
index aded2a7..4bf4aff 100644
--- a/simulation/app.go
+++ b/simulation/app.go
@@ -116,7 +116,7 @@ func (a *simApp) TotalOrderingDeliver(blockHashes common.Hashes, early bool) {
}
a.Outputs = blocks
a.Early = early
- //fmt.Println("OUTPUT", a.ValidatorID, a.Early, a.Outputs)
+ fmt.Println("OUTPUT", a.ValidatorID, a.Early, a.Outputs)
confirmLatency := []time.Duration{}
diff --git a/simulation/tcp-network.go b/simulation/tcp-network.go
index 31c8d95..468baff 100644
--- a/simulation/tcp-network.go
+++ b/simulation/tcp-network.go
@@ -168,6 +168,20 @@ func (n *TCPNetwork) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
n.recieveChan <- block
+ case "vote":
+ vote := &types.Vote{}
+ if err := json.Unmarshal(m.Payload, vote); err != nil {
+ w.WriteHeader(http.StatusBadRequest)
+ return
+ }
+ n.recieveChan <- vote
+ case "notaryAck":
+ ack := &types.NotaryAck{}
+ if err := json.Unmarshal(m.Payload, ack); err != nil {
+ w.WriteHeader(http.StatusBadRequest)
+ return
+ }
+ n.recieveChan <- ack
default:
w.WriteHeader(http.StatusBadRequest)
return
diff --git a/simulation/verification.go b/simulation/verification.go
index ad2c911..2e90b8b 100644
--- a/simulation/verification.go
+++ b/simulation/verification.go
@@ -202,7 +202,7 @@ func VerifyTotalOrder(id types.ValidatorID,
if hasError {
log.Printf("[%d] Hash is %v from %v\n", i, hash, id)
} else {
- //log.Printf("Block %v confirmed\n", hash)
+ log.Printf("Block %v confirmed\n", hash)
}
}