Skip to content

Commit

Permalink
Merge pull request #36 from zancas/darkside_reloaded_2
Browse files Browse the repository at this point in the history
guess that we want &self, and toss in implementations, could maybe be…
  • Loading branch information
fluidvanadium authored Nov 29, 2024
2 parents c8049a0 + 04ee632 commit 49a815b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
11 changes: 6 additions & 5 deletions darkside-tests/src/chain_generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) mod conduct_chain {
elf
}

fn lightserver_uri() -> Option<Uri> {
fn lightserver_uri(&self) -> Option<http::Uri> {
Some(self.client_builder.server_id.clone())
}

Expand All @@ -87,10 +87,11 @@ pub(crate) mod conduct_chain {
}

async fn bump_chain(&mut self) {
let height_before = zingolib::grpc_connector::get_latest_block(self.lightserver_uri())
.await
.unwrap()
.height;
let height_before =
zingolib::grpc_connector::get_latest_block(self.lightserver_uri().unwrap())
.await
.unwrap()
.height;

let blocks_to_add = 1;

Expand Down
2 changes: 1 addition & 1 deletion zingolib/src/lightclient/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pub mod send_with_proposal {
match crate::utils::conversion::txid_from_hex_encoded_str(
serverz_txid_string.as_str(),
) {
Ok(reported_txid) => {
Ok(_reported_txid) => {
// happens during darkside tests
// If this option is enabled, the LightClient will replace outgoing TxId records with the TxId picked by the server. necessary for darkside.
// #[cfg(feature = "darkside_tests")]
Expand Down
2 changes: 1 addition & 1 deletion zingolib/src/testutils/chain_generics/conduct_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub trait ConductChain {
async fn setup() -> Self;

/// used to connect to server via grpc
fn lightserver_uri() -> Option<Uri>;
fn lightserver_uri(&self) -> Option<http::Uri>;

/// builds a faucet (funded from mining)
async fn create_faucet(&mut self) -> LightClient;
Expand Down
4 changes: 4 additions & 0 deletions zingolib/src/testutils/chain_generics/libtonode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ impl ConductChain for LibtonodeEnvironment {
start_height + 1
);
}

fn lightserver_uri(&self) -> Option<http::Uri> {
todo!()
}
}
4 changes: 4 additions & 0 deletions zingolib/src/testutils/chain_generics/live_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ impl ConductChain for LiveChain {
// average block time is 75 seconds. we do this twice here to insist on a new block
tokio::time::sleep(std::time::Duration::from_secs(150)).await;
}

fn lightserver_uri(&self) -> Option<http::Uri> {
todo!()
}
}
10 changes: 6 additions & 4 deletions zingolib/src/testutils/chain_generics/with_assertions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ where
.expect("record is ok");

dbg!(
crate::grpc_connector::get_latest_block(sender.config.lightwalletd_uri.read().unwrap())
.await
.unwrap()
.height
crate::grpc_connector::get_latest_block(
sender.config.lightwalletd_uri.read().unwrap().to_owned()
)
.await
.unwrap()
.height
);

lookup_statuses(sender, txids.clone()).await.map(|status| {
Expand Down

0 comments on commit 49a815b

Please sign in to comment.