From a4b6b9e6a28a4d8fc49ee76c191454a819265713 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Thu, 20 Sep 2018 16:08:08 +0800 Subject: core: refactor witness data processing flow (#124) Since witness data need to include data from application after it processed a block (e.g. stateRoot). We should make the process of witness data asynchronous. An interface `BlockProcessedChan()` is added to the application interface to return a channel for notifying the consensus core when a block is processed. The notification object includes a byte slice (witenss data) which will be include in the final witness data object. --- core/interfaces.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/interfaces.go') diff --git a/core/interfaces.go b/core/interfaces.go index 4f67e1e..8ecfb3c 100644 --- a/core/interfaces.go +++ b/core/interfaces.go @@ -46,6 +46,10 @@ type Application interface { // DeliverBlock is called when a block is add to the compaction chain. DeliverBlock(blockHash common.Hash, timestamp time.Time) + // BlockProcessedChan returns a channel to receive the block hashes that have + // finished processing by the application. + BlockProcessedChan() <-chan types.WitnessResult + // WitnessAckDeliver is called when a witness ack is created. WitnessAckDeliver(witnessAck *types.WitnessAck) } -- cgit v1.2.3