Add node health check to transaction preflight
This commit is contained in:
@@ -255,6 +255,7 @@ impl JsonRpcService {
|
||||
block_commitment_cache,
|
||||
blockstore,
|
||||
validator_exit.clone(),
|
||||
health.clone(),
|
||||
)));
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -431,15 +432,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_is_file_get_path() {
|
||||
let bank_forks = create_bank_forks();
|
||||
let health = Arc::new(RpcHealth::new(
|
||||
Arc::new(ClusterInfo::new_with_invalid_keypair(ContactInfo::default())),
|
||||
let rrm = RpcRequestMiddleware::new(
|
||||
PathBuf::from("/"),
|
||||
None,
|
||||
42,
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
));
|
||||
|
||||
let rrm =
|
||||
RpcRequestMiddleware::new(PathBuf::from("/"), None, bank_forks.clone(), health.clone());
|
||||
bank_forks.clone(),
|
||||
RpcHealth::stub(),
|
||||
);
|
||||
let rrm_with_snapshot_config = RpcRequestMiddleware::new(
|
||||
PathBuf::from("/"),
|
||||
Some(SnapshotConfig {
|
||||
@@ -449,7 +447,7 @@ mod tests {
|
||||
compression: CompressionType::Bzip2,
|
||||
}),
|
||||
bank_forks,
|
||||
health,
|
||||
RpcHealth::stub(),
|
||||
);
|
||||
|
||||
assert!(rrm.is_file_get_path("/genesis.tar.bz2"));
|
||||
@@ -475,14 +473,12 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_health_check_with_no_trusted_validators() {
|
||||
let health = Arc::new(RpcHealth::new(
|
||||
Arc::new(ClusterInfo::new_with_invalid_keypair(ContactInfo::default())),
|
||||
let rm = RpcRequestMiddleware::new(
|
||||
PathBuf::from("/"),
|
||||
None,
|
||||
42,
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
));
|
||||
|
||||
let rm = RpcRequestMiddleware::new(PathBuf::from("/"), None, create_bank_forks(), health);
|
||||
create_bank_forks(),
|
||||
RpcHealth::stub(),
|
||||
);
|
||||
assert_eq!(rm.health_check(), "ok");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user