aboutsummaryrefslogtreecommitdiffstats
path: root/core/nonblocking-application.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-08-22 11:33:39 +0800
committerGitHub <noreply@github.com>2018-08-22 11:33:39 +0800
commit89a65a152ae7956bcf6d241eb15d66e6d955b819 (patch)
treeec157eab266cf3dd76a94cfdbe90d35a08a2e492 /core/nonblocking-application.go
parent2c816b5d636b8f7decd234582470a3d4c6b4a93a (diff)
downloadtangerine-consensus-89a65a152ae7956bcf6d241eb15d66e6d955b819.tar.gz
tangerine-consensus-89a65a152ae7956bcf6d241eb15d66e6d955b819.tar.zst
tangerine-consensus-89a65a152ae7956bcf6d241eb15d66e6d955b819.zip
core: Notary ack application. (#70)
Diffstat (limited to 'core/nonblocking-application.go')
-rw-r--r--core/nonblocking-application.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/nonblocking-application.go b/core/nonblocking-application.go
index 921fe3e..ccdf42e 100644
--- a/core/nonblocking-application.go
+++ b/core/nonblocking-application.go
@@ -40,6 +40,10 @@ type deliverBlockEvent struct {
timestamp time.Time
}
+type notaryAckEvent struct {
+ notaryAck *types.NotaryAck
+}
+
// nonBlockingApplication implements Application and is a decorator for
// Application that makes the methods to be non-blocking.
type nonBlockingApplication struct {
@@ -90,6 +94,8 @@ func (app *nonBlockingApplication) run() {
app.app.TotalOrderingDeliver(e.blockHashes, e.early)
case deliverBlockEvent:
app.app.DeliverBlock(e.blockHash, e.timestamp)
+ case notaryAckEvent:
+ app.app.NotaryAckDeliver(e.notaryAck)
default:
fmt.Printf("Unknown event %v.", e)
}
@@ -128,4 +134,5 @@ func (app *nonBlockingApplication) DeliverBlock(
// NotaryAckDeliver is called when a notary ack is created.
func (app *nonBlockingApplication) NotaryAckDeliver(notaryAck *types.NotaryAck) {
+ app.addEvent(notaryAckEvent{notaryAck})
}