|
15 | 15 | // along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 | 16 |
|
17 | 17 | use std::str::FromStr; |
| 18 | +use std::sync::Arc; |
18 | 19 | use std::{fmt, fs}; |
19 | 20 |
|
20 | 21 | use ccore::Spec; |
| 22 | +use cstate::ActionHandler; |
21 | 23 |
|
22 | 24 | #[derive(Debug, PartialEq, Deserialize)] |
23 | 25 | #[serde(rename_all = "snake_case")] |
@@ -66,17 +68,17 @@ impl fmt::Display for ChainType { |
66 | 68 | } |
67 | 69 |
|
68 | 70 | impl ChainType { |
69 | | - pub fn spec<'a>(&self) -> Result<Spec, String> { |
| 71 | + pub fn spec<'a>(&self, handlers: Vec<Arc<ActionHandler>>) -> Result<Spec, String> { |
70 | 72 | match self { |
71 | | - ChainType::Solo => Ok(Spec::new_test_solo()), |
72 | | - ChainType::SoloAuthority => Ok(Spec::new_test_solo_authority()), |
73 | | - ChainType::Tendermint => Ok(Spec::new_test_tendermint()), |
74 | | - ChainType::Cuckoo => Ok(Spec::new_test_cuckoo()), |
75 | | - ChainType::BlakePoW => Ok(Spec::new_test_blake_pow()), |
| 73 | + ChainType::Solo => Ok(Spec::new_test_solo(handlers)), |
| 74 | + ChainType::SoloAuthority => Ok(Spec::new_test_solo_authority(handlers)), |
| 75 | + ChainType::Tendermint => Ok(Spec::new_test_tendermint(handlers)), |
| 76 | + ChainType::Cuckoo => Ok(Spec::new_test_cuckoo(handlers)), |
| 77 | + ChainType::BlakePoW => Ok(Spec::new_test_blake_pow(handlers)), |
76 | 78 | ChainType::Custom(filename) => { |
77 | 79 | let file = fs::File::open(filename) |
78 | 80 | .map_err(|e| format!("Could not load specification file at {}: {}", filename, e))?; |
79 | | - Spec::load(file) |
| 81 | + Spec::load(file, handlers) |
80 | 82 | } |
81 | 83 | } |
82 | 84 | } |
|
0 commit comments