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.
This commit is contained in:
peilun-conflux 2024-03-29 16:15:01 +08:00 committed by GitHub
parent f9ce286909
commit 588bf39d7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -373,8 +373,10 @@ impl LogSyncManager {
break; break;
} }
if let Err(e) = self.event_send.send(LogSyncEvent::TxSynced { tx }) { if let Err(e) = self.event_send.send(LogSyncEvent::TxSynced { tx }) {
error!("log sync broadcast error, error={:?}", e); // TODO: Do we need to wait until all receivers are initialized?
break; // 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) => { LogFetchProgress::Reverted(reverted) => {

View File

@ -138,7 +138,9 @@ class TestFramework:
# make nodes full connected # make nodes full connected
if self.num_blockchain_nodes > 1: if self.num_blockchain_nodes > 1:
connect_sample_nodes(self.blockchain_nodes, self.log) 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) 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) self.contract = FlowContractProxy(contract, self.blockchain_nodes)