diff --git a/node/chunk_pool/src/mem_pool/chunk_pool_inner.rs b/node/chunk_pool/src/mem_pool/chunk_pool_inner.rs index 8d5aec3..857ca02 100644 --- a/node/chunk_pool/src/mem_pool/chunk_pool_inner.rs +++ b/node/chunk_pool/src/mem_pool/chunk_pool_inner.rs @@ -265,12 +265,17 @@ impl MemoryChunkPool { Ok(LogSyncEvent::ReorgDetected { .. }) => {} Ok(LogSyncEvent::Reverted { .. }) => {} Ok(LogSyncEvent::TxSynced { tx }) => { - if let Err(e) = chunk_pool.update_file_info(&tx).await { - error!( - "Failed to update file info. tx seq={}, tx_root={}, error={}", - tx.seq, tx.data_merkle_root, e - ); - } + // This may take a while, so execute it asynchronously to ensure the + // channel will not be saturated. + let chunk_pool_cloned = chunk_pool.clone(); + tokio::spawn(async move { + if let Err(e) = chunk_pool_cloned.update_file_info(&tx).await { + error!( + "Failed to update file info. tx seq={}, tx_root={}, error={}", + tx.seq, tx.data_merkle_root, e + ); + } + }); } Err(RecvError::Closed) => { // program terminated diff --git a/node/log_entry_sync/src/sync_manager/mod.rs b/node/log_entry_sync/src/sync_manager/mod.rs index b90fbbb..9cc487a 100644 --- a/node/log_entry_sync/src/sync_manager/mod.rs +++ b/node/log_entry_sync/src/sync_manager/mod.rs @@ -19,7 +19,9 @@ use tokio::sync::mpsc::UnboundedReceiver; use tokio::sync::{oneshot, RwLock}; const RETRY_WAIT_MS: u64 = 500; -const BROADCAST_CHANNEL_CAPACITY: usize = 16; + +// A RPC query can return at most 10000 entries. +const BROADCAST_CHANNEL_CAPACITY: usize = 10000; const CATCH_UP_END_GAP: u64 = 10; #[derive(Clone, Debug)] diff --git a/tests/mine_test.py b/tests/mine_test.py index db9ca53..f93a8d3 100755 --- a/tests/mine_test.py +++ b/tests/mine_test.py @@ -13,7 +13,7 @@ class MineTest(TestFramework): self.zgs_node_configs[0] = { "miner_key": GENESIS_PRIV_KEY, } - self.mine_period = int(20 / self.block_time) + self.mine_period = int(40 / self.block_time) self.launch_wait_seconds = 15 self.log.info("Contract Info: Est. block time %.2f, Mine period %d", self.block_time, self.mine_period)