diff --git a/crates/sui-core/src/authority_active/gossip/mod.rs b/crates/sui-core/src/authority_active/gossip/mod.rs index 5bd94945d0107..001c23710b841 100644 --- a/crates/sui-core/src/authority_active/gossip/mod.rs +++ b/crates/sui-core/src/authority_active/gossip/mod.rs @@ -45,6 +45,16 @@ use super::ActiveAuthority; pub async fn gossip_process(active_authority: &ActiveAuthority, degree: usize) where A: AuthorityAPI + Send + Sync + 'static + Clone, +{ + gossip_process_with_start_seq(active_authority, degree, None).await +} + +pub async fn gossip_process_with_start_seq( + active_authority: &ActiveAuthority, + degree: usize, + start_seq: Option, +) where + A: AuthorityAPI + Send + Sync + 'static + Clone, { // A copy of the committee let committee = &active_authority.net.committee; @@ -93,7 +103,7 @@ where peer_names.insert(name); gossip_tasks.push(async move { - let peer_gossip = PeerGossip::new(name, active_authority); + let peer_gossip = PeerGossip::new(name, active_authority, start_seq); // Add more duration if we make more than 1 to ensure overlap debug!("Starting gossip from peer {:?}", name); peer_gossip @@ -185,12 +195,16 @@ impl PeerGossip where A: AuthorityAPI + Send + Sync + 'static + Clone, { - pub fn new(peer_name: AuthorityName, active_authority: &ActiveAuthority) -> PeerGossip { + pub fn new( + peer_name: AuthorityName, + active_authority: &ActiveAuthority, + start_seq: Option, + ) -> PeerGossip { PeerGossip { peer_name, client: active_authority.net.authority_clients[&peer_name].clone(), state: active_authority.state.clone(), - max_seq: None, + max_seq: start_seq, aggregator: active_authority.net.clone(), } } diff --git a/crates/sui-node/src/lib.rs b/crates/sui-node/src/lib.rs index 2ccdeb4ee3f73..a611125c147c1 100644 --- a/crates/sui-node/src/lib.rs +++ b/crates/sui-node/src/lib.rs @@ -9,7 +9,7 @@ use sui_config::NodeConfig; use sui_core::authority_server::ValidatorService; use sui_core::{ authority::{AuthorityState, AuthorityStore}, - authority_active::{gossip::gossip_process, ActiveAuthority}, + authority_active::{gossip::gossip_process_with_start_seq, ActiveAuthority}, authority_client::NetworkAuthorityClient, checkpoints::CheckpointStore, }; @@ -91,10 +91,12 @@ impl SuiNode { // Start following validators Some(tokio::task::spawn(async move { - gossip_process( + gossip_process_with_start_seq( &active_authority, // listen to all authorities (note that gossip_process caps this to total minus 1.) active_authority.state.committee.voting_rights.len(), + // start receiving the earliest TXes the validator has. + Some(0), ) .await; })) diff --git a/crates/sui/tests/full_node_tests.rs b/crates/sui/tests/full_node_tests.rs index 6ddbbaa37f33e..5aef7ca666f70 100644 --- a/crates/sui/tests/full_node_tests.rs +++ b/crates/sui/tests/full_node_tests.rs @@ -198,15 +198,12 @@ async fn test_full_node_cold_sync() -> Result<(), anyhow::Error> { let (_, _, _, _) = transfer_coin(&mut context).await?; let (_, _, _, _) = transfer_coin(&mut context).await?; let (_, _, _, _) = transfer_coin(&mut context).await?; + let (_transfered_object, sender, _receiver, digest) = transfer_coin(&mut context).await?; sleep(Duration::from_millis(1000)).await; let node = start_full_node(&working_dir).await?; - // Note: currently we have to send one tx after starting the full node in order for it - // to start syncing, because the node doesn't request old txes immediately upon startup. - let (_transfered_object, sender, _receiver, digest) = transfer_coin(&mut context).await?; - wait_for_tx(digest, node.state().clone()).await; let txes = node.state().get_transactions_from_addr(sender).await?;