From ecc5e12b1ac4826e302607769f5b831ab4c27046 Mon Sep 17 00:00:00 2001 From: Mission Liao Date: Mon, 1 Apr 2019 12:25:09 +0800 Subject: core: clean TODOs (#539) * core: fix block timestamp (#529) * Remove TODO dMoment is still required when the block timestamp of the genesis block is still need to be verified. * Refine timestamp when preparing blocks * Add timestamp checking in sanity check * Revert code to patch position when preparing * Remove TODOs that seems meaningless now * Remove TODOs related to refactoring * core: remove finalization (#531) - Remove types.FinalizationResult, randomness field would be moved to `types.Block` directly. - Add a placeholder for types.Block.Randomness field for blocks proposed from round < DKGDelayRound. (refer to core.NoRand) - Make the height of the genesis block starts from 1. (refer to types.GenesisHeight) - The fullnode's behavior of core.Governance.GetRoundHeight is (assume round-length is 100): - round: 0 -> 0 (we need to workaround this) - round: 1 -> 101 - round: 2 -> 201 - test.Governance already simulate this behavior, and the workaround is wrapped at utils.GetRoundHeight. * core: fix issues (#536) fixing code in these condition: - assigning position without initializing them and expected it's for genesis - compare height with 0 --- core/nonblocking.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/nonblocking.go') diff --git a/core/nonblocking.go b/core/nonblocking.go index 095170b..10b47b8 100644 --- a/core/nonblocking.go +++ b/core/nonblocking.go @@ -32,7 +32,7 @@ type blockConfirmedEvent struct { type blockDeliveredEvent struct { blockHash common.Hash blockPosition types.Position - result *types.FinalizationResult + rand []byte } // nonBlocking implements these interfaces and is a decorator for @@ -87,7 +87,7 @@ func (nb *nonBlocking) run() { case blockConfirmedEvent: nb.app.BlockConfirmed(*e.block) case blockDeliveredEvent: - nb.app.BlockDelivered(e.blockHash, e.blockPosition, *e.result) + nb.app.BlockDelivered(e.blockHash, e.blockPosition, e.rand) default: fmt.Printf("Unknown event %v.", e) } @@ -128,10 +128,10 @@ func (nb *nonBlocking) BlockConfirmed(block types.Block) { // BlockDelivered is called when a block is add to the compaction chain. func (nb *nonBlocking) BlockDelivered(blockHash common.Hash, - blockPosition types.Position, result types.FinalizationResult) { + blockPosition types.Position, rand []byte) { nb.addEvent(blockDeliveredEvent{ blockHash: blockHash, blockPosition: blockPosition, - result: &result, + rand: rand, }) } -- cgit v1.2.3