Skip to content

Commit c4b3f41

Browse files
committed
test(node): fix possible double panic if this test fails
1 parent abbd511 commit c4b3f41

File tree

1 file changed

+24
-21
lines changed
  • node/src/actors/chain_manager

1 file changed

+24
-21
lines changed

node/src/actors/chain_manager/mod.rs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,6 +2946,7 @@ pub fn run_dr_locally(dr: &DataRequestOutput) -> Result<RadonTypes, failure::Err
29462946

29472947
#[cfg(test)]
29482948
mod tests {
2949+
use crate::utils::test_actix_system;
29492950
use witnet_config::{config::consensus_constants_from_partial, defaults::Testnet};
29502951
use witnet_data_structures::{
29512952
chain::{
@@ -3067,28 +3068,30 @@ mod tests {
30673068

30683069
#[test]
30693070
fn get_superblock_beacon() {
3070-
let mut chain_manager = ChainManager::default();
3071-
chain_manager.chain_state.chain_info = Some(ChainInfo {
3072-
environment: Environment::default(),
3073-
consensus_constants: consensus_constants_from_partial(
3074-
&PartialConsensusConstants::default(),
3075-
&Testnet,
3076-
),
3077-
highest_block_checkpoint: CheckpointBeacon::default(),
3078-
highest_superblock_checkpoint: CheckpointBeacon {
3079-
checkpoint: 0,
3080-
hash_prev_block: Hash::SHA256([1; 32]),
3081-
},
3082-
highest_vrf_output: CheckpointVRF::default(),
3083-
});
3071+
test_actix_system(|| async {
3072+
let mut chain_manager = ChainManager::default();
3073+
chain_manager.chain_state.chain_info = Some(ChainInfo {
3074+
environment: Environment::default(),
3075+
consensus_constants: consensus_constants_from_partial(
3076+
&PartialConsensusConstants::default(),
3077+
&Testnet,
3078+
),
3079+
highest_block_checkpoint: CheckpointBeacon::default(),
3080+
highest_superblock_checkpoint: CheckpointBeacon {
3081+
checkpoint: 0,
3082+
hash_prev_block: Hash::SHA256([1; 32]),
3083+
},
3084+
highest_vrf_output: CheckpointVRF::default(),
3085+
});
30843086

3085-
assert_eq!(
3086-
chain_manager.get_superblock_beacon(),
3087-
CheckpointBeacon {
3088-
checkpoint: 0,
3089-
hash_prev_block: Hash::SHA256([1; 32]),
3090-
}
3091-
);
3087+
assert_eq!(
3088+
chain_manager.get_superblock_beacon(),
3089+
CheckpointBeacon {
3090+
checkpoint: 0,
3091+
hash_prev_block: Hash::SHA256([1; 32]),
3092+
}
3093+
);
3094+
});
30923095
}
30933096

30943097
#[test]

0 commit comments

Comments
 (0)