aboutsummaryrefslogtreecommitdiffstats
path: root/core/nonblocking-application.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/nonblocking-application.go')
-rw-r--r--core/nonblocking-application.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/nonblocking-application.go b/core/nonblocking-application.go
index 72f63b9..fb25745 100644
--- a/core/nonblocking-application.go
+++ b/core/nonblocking-application.go
@@ -26,6 +26,10 @@ import (
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
+type blockConfirmedEvent struct {
+ block *types.Block
+}
+
type stronglyAckedEvent struct {
blockHash common.Hash
}
@@ -90,6 +94,8 @@ func (app *nonBlockingApplication) run() {
switch e := event.(type) {
case stronglyAckedEvent:
app.app.StronglyAcked(e.blockHash)
+ case blockConfirmedEvent:
+ app.app.BlockConfirmed(e.block)
case totalOrderingDeliverEvent:
app.app.TotalOrderingDeliver(e.blockHashes, e.early)
case deliverBlockEvent:
@@ -120,6 +126,16 @@ func (app *nonBlockingApplication) PreparePayloads(
return app.app.PreparePayloads(shardID, chainID, height)
}
+// VerifyPayloads cannot be non-blocking.
+func (app *nonBlockingApplication) VerifyPayloads(payloads [][]byte) bool {
+ return true
+}
+
+// BlockConfirmed is called when a block is confirmed and added to lattice.
+func (app *nonBlockingApplication) BlockConfirmed(block *types.Block) {
+ app.addEvent(blockConfirmedEvent{block})
+}
+
// StronglyAcked is called when a block is strongly acked.
func (app *nonBlockingApplication) StronglyAcked(blockHash common.Hash) {
app.addEvent(stronglyAckedEvent{blockHash})