Skip to content

Commit

Permalink
[mempool] On node start set mempool_client_sender in admin service
Browse files Browse the repository at this point in the history
  • Loading branch information
hariria committed Oct 4, 2024
1 parent db53019 commit 0dad6bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion aptos-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ where
let config = OnChainJWKConsensusConfig::default_enabled();
println!("Flag `INITIALIZE_JWK_CONSENSUS` detected, will enable JWK Consensus for all default OIDC providers in genesis: {:?}", config);
Some(config)
},
}
_ => None,
};
})))
Expand Down Expand Up @@ -704,6 +704,7 @@ pub fn setup_environment_and_start_node(
indexer_runtime,
indexer_grpc_runtime,
internal_indexer_db_runtime,
mempool_client_sender,
) = services::bootstrap_api_and_indexer(
&node_config,
db_rw.clone(),
Expand All @@ -714,6 +715,9 @@ pub fn setup_environment_and_start_node(
indexer_grpc_port_tx,
)?;

// Set mempool client sender in order to enable the Mempool API in the admin service
admin_service.set_mempool_client_sender(mempool_client_sender);

// Create mempool and get the consensus to mempool sender
let (mempool_runtime, consensus_to_mempool_sender) =
services::start_mempool_runtime_and_get_consensus_sender(
Expand Down
8 changes: 6 additions & 2 deletions aptos-node/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ use aptos_indexer_grpc_table_info::runtime::{
bootstrap as bootstrap_indexer_table_info, bootstrap_internal_indexer_db,
};
use aptos_logger::{debug, telemetry_log_writer::TelemetryLog, LoggerFilterUpdater};
use aptos_mempool::{network::MempoolSyncMsg, MempoolClientRequest, QuorumStoreRequest};
use aptos_mempool::{
network::MempoolSyncMsg, MempoolClientRequest, MempoolClientSender, QuorumStoreRequest,
};
use aptos_mempool_notifications::MempoolNotificationListener;
use aptos_network::application::{interface::NetworkClientInterface, storage::PeersAndMetadata};
use aptos_network_benchmark::{run_netbench_service, NetbenchMessage};
Expand Down Expand Up @@ -59,6 +61,7 @@ pub fn bootstrap_api_and_indexer(
Option<Runtime>,
Option<Runtime>,
Option<Runtime>,
MempoolClientSender,
)> {
// Create the mempool client and sender
let (mempool_client_sender, mempool_client_receiver) =
Expand Down Expand Up @@ -120,7 +123,7 @@ pub fn bootstrap_api_and_indexer(
node_config,
chain_id,
db_rw.reader.clone(),
mempool_client_sender,
mempool_client_sender.clone(),
)?;

Ok((
Expand All @@ -130,6 +133,7 @@ pub fn bootstrap_api_and_indexer(
indexer_runtime,
indexer_grpc,
db_indexer_runtime,
mempool_client_sender,
))
}

Expand Down

0 comments on commit 0dad6bf

Please sign in to comment.