aboutsummaryrefslogtreecommitdiffstats
path: root/core/nonblocking.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-01 18:19:52 +0800
committerGitHub <noreply@github.com>2018-10-01 18:19:52 +0800
commit9c33b9dc8aa59d414a6697f1e2d036e5581860ee (patch)
tree74a4a77b5c28fa9a550fe1ba40b5b2efac0e7630 /core/nonblocking.go
parent9b78db7a4744176070bf968d50dbebb191b28b69 (diff)
downloaddexon-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar
dexon-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.gz
dexon-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.bz2
dexon-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.lz
dexon-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.xz
dexon-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.tar.zst
dexon-consensus-9c33b9dc8aa59d414a6697f1e2d036e5581860ee.zip
core: update data model to reflect new model (#157)
Update data model: 1) Remove witness ack. 2) Add round to block. 3) Update governance interface.
Diffstat (limited to 'core/nonblocking.go')
-rw-r--r--core/nonblocking.go30
1 files changed, 6 insertions, 24 deletions
diff --git a/core/nonblocking.go b/core/nonblocking.go
index 1dd1ded..2e5bfeb 100644
--- a/core/nonblocking.go
+++ b/core/nonblocking.go
@@ -42,10 +42,6 @@ type blockDeliveredEvent struct {
block *types.Block
}
-type witnessAckEvent struct {
- witnessAck *types.WitnessAck
-}
-
// nonBlocking implements these interfaces and is a decorator for
// them that makes the methods to be non-blocking.
// - Application
@@ -103,8 +99,6 @@ func (nb *nonBlocking) run() {
nb.debug.TotalOrderingDelivered(e.blockHashes, e.early)
case blockDeliveredEvent:
nb.app.BlockDelivered(*e.block)
- case witnessAckEvent:
- nb.app.WitnessAckDelivered(e.witnessAck)
default:
fmt.Printf("Unknown event %v.", e)
}
@@ -123,15 +117,14 @@ func (nb *nonBlocking) wait() {
nb.running.Wait()
}
-// PreparePayload cannot be non-blocking.
-func (nb *nonBlocking) PreparePayload(
- position types.Position) []byte {
- return nb.app.PreparePayload(position)
+// PrepareBlock cannot be non-blocking.
+func (nb *nonBlocking) PrepareBlock(position types.Position) ([]byte, []byte) {
+ return nb.app.PrepareBlock(position)
}
-// VerifyPayload cannot be non-blocking.
-func (nb *nonBlocking) VerifyPayload(payload []byte) bool {
- return nb.app.VerifyPayload(payload)
+// VerifyBlock cannot be non-blocking.
+func (nb *nonBlocking) VerifyBlock(block *types.Block) bool {
+ return nb.app.VerifyBlock(block)
}
// BlockConfirmed is called when a block is confirmed and added to lattice.
@@ -161,14 +154,3 @@ func (nb *nonBlocking) TotalOrderingDelivered(
func (nb *nonBlocking) BlockDelivered(block types.Block) {
nb.addEvent(blockDeliveredEvent{&block})
}
-
-// BlockProcessedChan returns a channel to receive the block hashes that have
-// finished processing by the application.
-func (nb *nonBlocking) BlockProcessedChan() <-chan types.WitnessResult {
- return nb.app.BlockProcessedChan()
-}
-
-// WitnessAckDelivered is called when a witness ack is created.
-func (nb *nonBlocking) WitnessAckDelivered(witnessAck *types.WitnessAck) {
- nb.addEvent(witnessAckEvent{witnessAck})
-}