From 588bf39d7deb3d9ae3896c0418cc3e272ee18ab4 Mon Sep 17 00:00:00 2001 From: peilun-conflux <48905552+peilun-conflux@users.noreply.github.com> Date: Fri, 29 Mar 2024 16:15:01 +0800 Subject: [PATCH] Fix a possible log sync break after a node restarts. (#34) * Fix a possible log sync break after a node restarts. * Skip `sync_blocks` in blockchain node setup. --- node/log_entry_sync/src/sync_manager/mod.rs | 6 ++++-- tests/test_framework/test_framework.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/node/log_entry_sync/src/sync_manager/mod.rs b/node/log_entry_sync/src/sync_manager/mod.rs index 8e8fe40..aabbe57 100644 --- a/node/log_entry_sync/src/sync_manager/mod.rs +++ b/node/log_entry_sync/src/sync_manager/mod.rs @@ -373,8 +373,10 @@ impl LogSyncManager { break; } if let Err(e) = self.event_send.send(LogSyncEvent::TxSynced { tx }) { - error!("log sync broadcast error, error={:?}", e); - break; + // TODO: Do we need to wait until all receivers are initialized? + // Auto-sync and txpool may need this event, but it's possible that + // no receivers will be created. + warn!("log sync broadcast error, error={:?}", e); } } LogFetchProgress::Reverted(reverted) => { diff --git a/tests/test_framework/test_framework.py b/tests/test_framework/test_framework.py index d5e94e3..e14bc09 100644 --- a/tests/test_framework/test_framework.py +++ b/tests/test_framework/test_framework.py @@ -138,7 +138,9 @@ class TestFramework: # make nodes full connected if self.num_blockchain_nodes > 1: connect_sample_nodes(self.blockchain_nodes, self.log) - sync_blocks(self.blockchain_nodes) + # The default is `dev` mode with auto mining, so it's not guaranteed that blocks + # can be synced in time for `sync_blocks` to pass. + # sync_blocks(self.blockchain_nodes) contract, tx_hash, mine_contract, reward_contract = self.blockchain_nodes[0].setup_contract(self.enable_market, self.mine_period) self.contract = FlowContractProxy(contract, self.blockchain_nodes)