From 9f240d93507cdf03935ba7e4e3a7b226f150736d Mon Sep 17 00:00:00 2001 From: Mission Liao Date: Tue, 18 Dec 2018 15:38:51 +0800 Subject: syncer: fix stuffs (#373) * Add a new method: GetSyncedConsensus This method avoids calling BlockDelivered in SyncBlocks methods, which avoid potential deadlock. * Add a method to stop the syncer before synced * Enable nonBlockingApp for synced Consensus instance. --- integration_test/consensus_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'integration_test') diff --git a/integration_test/consensus_test.go b/integration_test/consensus_test.go index 08a1d10..2680cd2 100644 --- a/integration_test/consensus_test.go +++ b/integration_test/consensus_test.go @@ -145,8 +145,13 @@ func (s *ConsensusTestSuite) syncBlocksWithSomeNode( syncNode.gov.CatchUpWithRound( b.Position.Round + core.ConfigRoundShift) } - syncedCon, err = syncerObj.SyncBlocks(compactionChainBlocks, true) - if syncedCon != nil || err != nil { + var synced bool + synced, err = syncerObj.SyncBlocks(compactionChainBlocks, true) + if err != nil { + done = true + } + if synced { + syncedCon, err = syncerObj.GetSyncedConsensus() done = true } compactionChainBlocks = nil -- cgit v1.2.3