diff --git a/examples/neutron_osmosis.rs b/examples/neutron_osmosis.rs index 45d6c8e..8b8ac6a 100644 --- a/examples/neutron_osmosis.rs +++ b/examples/neutron_osmosis.rs @@ -1,5 +1,5 @@ use localic_utils::{ConfigChainBuilder, TestContextBuilder}; -use std::error::Error; +use std::{error::Error, thread, time::Duration}; const ACC_0_ADDR: &str = "osmo1hj5fveer5cjtn4wd6wstzugjfdxzl0xpwhpz63"; const NEUTRON_ACC_0_ADDR: &str = "neutron1hj5fveer5cjtn4wd6wstzugjfdxzl0xpznmsky"; @@ -22,6 +22,9 @@ fn main() -> Result<(), Box> { ctx.stop_relayer(); ctx.start_relayer(); + // Wait for the relayer to start up + thread::sleep(Duration::from_secs(10)); + ctx.build_tx_create_tokenfactory_token() .with_chain_name("neutron") .with_subdenom("bruhtoken") diff --git a/src/utils/setup/ibc.rs b/src/utils/setup/ibc.rs index 5f20312..a8e9905 100644 --- a/src/utils/setup/ibc.rs +++ b/src/utils/setup/ibc.rs @@ -138,20 +138,28 @@ impl TestContext { } pub fn start_relayer(&mut self) { - let neutron = self.get_chain(NEUTRON_CHAIN_NAME); + // Any random chain will allow us to kill the relayer, + // so select any chain we can get the API URL from + let chain = self.chains.values().next().unwrap(); + // See above. chain_id does not matter, since there is + // one relayer running reqwest::blocking::Client::default() - .post(&neutron.rb.api) + .post(&chain.rb.api) .json(&serde_json::json!({ "chain_id": NEUTRON_CHAIN_ID, "action": "start-relayer"})) .send() .unwrap(); } pub fn stop_relayer(&mut self) { - let neutron = self.get_chain(NEUTRON_CHAIN_NAME); + // Any random chain will allow us to kill the relayer, + // so select any chain we can get the API URL from + let chain = self.chains.values().next().unwrap(); + // See above. chain_id does not matter, since there is + // one relayer running reqwest::blocking::Client::default() - .post(&neutron.rb.api) + .post(&chain.rb.api) .json(&serde_json::json!({ "chain_id": NEUTRON_CHAIN_ID, "action": "stop-relayer"})) .send() .unwrap();