Skip to content

Commit

Permalink
Cleaning up some println statements
Browse files Browse the repository at this point in the history
  • Loading branch information
bjohnson5 committed Dec 11, 2024
1 parent 05fd5f1 commit 4cf6e93
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 46 deletions.
84 changes: 42 additions & 42 deletions blast_example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async fn new_simulation(model_dir: String) {
let models = match blast.create_network("test", m, running.clone()).await {
Ok(m) => m,
Err(e) => {
println!("{}", format!("Failed to start network: {}", e));
println!("Failed to start network: {}", e);
return;
}
};
Expand All @@ -92,7 +92,7 @@ async fn new_simulation(model_dir: String) {
println!("PubKey Node {}: {}", node_id, s);
},
Err(e) => {
println!("{}", format!("Unable to get pub key: {}", e));
println!("Unable to get pub key: {}", e);
}
}
}
Expand All @@ -102,7 +102,7 @@ async fn new_simulation(model_dir: String) {
println!("Peers Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list peers: {}", e));
println!("Unable to list peers: {}", e);
}
}

Expand All @@ -111,7 +111,7 @@ async fn new_simulation(model_dir: String) {
println!("Peers Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list peers: {}", e));
println!("Unable to list peers: {}", e);
}
}

Expand All @@ -120,7 +120,7 @@ async fn new_simulation(model_dir: String) {
println!("Wallet Balance Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -129,7 +129,7 @@ async fn new_simulation(model_dir: String) {
println!("Wallet Balance Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -138,7 +138,7 @@ async fn new_simulation(model_dir: String) {
println!("Channel Balance Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -147,7 +147,7 @@ async fn new_simulation(model_dir: String) {
println!("Channel Balance Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -156,7 +156,7 @@ async fn new_simulation(model_dir: String) {
println!("Channels Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list peers: {}", e));
println!("Unable to list peers: {}", e);
}
}

Expand All @@ -165,7 +165,7 @@ async fn new_simulation(model_dir: String) {
println!("Channels Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list peers: {}", e));
println!("Unable to list peers: {}", e);
}
}

Expand All @@ -176,21 +176,21 @@ async fn new_simulation(model_dir: String) {
match blast.fund_node(String::from("blast_lnd-0000"), 1.0, true).await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Unable to fund node: {}", e));
println!("Unable to fund node: {}", e);
}
}

match blast.fund_node(String::from("blast_lnd-0001"), 1.0, true).await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Unable to fund node: {}", e));
println!("Unable to fund node: {}", e);
}
}

match blast.connect_peer(String::from("blast_lnd-0000"), String::from("blast_lnd-0001")).await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Unable to connect peers: {}", e));
println!("Unable to connect peers: {}", e);
}
}

Expand All @@ -199,7 +199,7 @@ async fn new_simulation(model_dir: String) {
println!("Peers Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list peers: {}", e));
println!("Unable to list peers: {}", e);
}
}

Expand All @@ -208,7 +208,7 @@ async fn new_simulation(model_dir: String) {
println!("Peers Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list peers: {}", e));
println!("Unable to list peers: {}", e);
}
}

Expand All @@ -217,7 +217,7 @@ async fn new_simulation(model_dir: String) {
println!("Wallet Balance Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -226,7 +226,7 @@ async fn new_simulation(model_dir: String) {
println!("Wallet Balance Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -235,7 +235,7 @@ async fn new_simulation(model_dir: String) {
println!("Channel Balance Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -244,7 +244,7 @@ async fn new_simulation(model_dir: String) {
println!("Channel Balance Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -255,7 +255,7 @@ async fn new_simulation(model_dir: String) {
match blast.open_channel(String::from("blast_lnd-0000"), String::from("blast_lnd-0001"), 30000, 0, 0, true).await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Unable to open channel: {}", e));
println!("Unable to open channel: {}", e);
}
}

Expand All @@ -264,7 +264,7 @@ async fn new_simulation(model_dir: String) {
println!("Channels Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list channels: {}", e));
println!("Unable to list channels: {}", e);
}
}

Expand All @@ -273,7 +273,7 @@ async fn new_simulation(model_dir: String) {
println!("Channels Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list channels: {}", e));
println!("Unable to list channels: {}", e);
}
}

Expand All @@ -282,7 +282,7 @@ async fn new_simulation(model_dir: String) {
println!("Channel Balance Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -291,7 +291,7 @@ async fn new_simulation(model_dir: String) {
println!("Channel Balance Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -306,14 +306,14 @@ async fn new_simulation(model_dir: String) {
match blast.add_event(5, "StartNode", Some(good_start.clone())) {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Error adding event: {}", e));
println!("Error adding event: {}", e);
}
}

match blast.add_event(5, "StopNode", Some(good_start.clone())) {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Error adding event: {}", e));
println!("Error adding event: {}", e);
}
}

Expand All @@ -323,7 +323,7 @@ async fn new_simulation(model_dir: String) {
match blast.add_event(10, "CloseChannel", Some(good_close.clone())) {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Error adding event: {}", e));
println!("Error adding event: {}", e);
}
}

Expand All @@ -337,7 +337,7 @@ async fn new_simulation(model_dir: String) {
match blast.add_event(23, "OpenChannel", Some(good_open.clone())) {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Error adding event: {}", e));
println!("Error adding event: {}", e);
}
}

Expand All @@ -348,7 +348,7 @@ async fn new_simulation(model_dir: String) {
match blast.save("test1").await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Error saving simulation: {}", e));
println!("Error saving simulation: {}", e);
}
}

Expand Down Expand Up @@ -405,13 +405,13 @@ async fn new_simulation(model_dir: String) {
match blast.connect_peer(String::from("blast_lnd-0000"), param.clone()).await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Unable to connect peers: {}", e));
println!("Unable to connect peers: {}", e);
}
}
match blast.open_channel(String::from("blast_lnd-0000"), param.clone(), 30000, 0, i, true).await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Unable to open channel: {}", e));
println!("Unable to open channel: {}", e);
}
}

Expand All @@ -427,7 +427,7 @@ async fn new_simulation(model_dir: String) {
println!("Peers Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list peers: {}", e));
println!("Unable to list peers: {}", e);
}
}

Expand All @@ -436,14 +436,14 @@ async fn new_simulation(model_dir: String) {
println!("Channels Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list channels: {}", e));
println!("Unable to list channels: {}", e);
}
}

match blast.save("test2").await {
Ok(_) => {},
Err(e) => {
println!("{}", format!("Error saving simulation: {}", e));
println!("Error saving simulation: {}", e);
}
}

Expand Down Expand Up @@ -541,7 +541,7 @@ async fn load_simulation(name: String, model_dir: String) {
let models = match blast.load(&name, running.clone()).await {
Ok(m) => m,
Err(e) => {
println!("{}", format!("Failed to start network: {}", e));
println!("Failed to start network: {}", e);
match blast.stop_network().await {
Ok(_) => {},
Err(e) => {
Expand All @@ -562,7 +562,7 @@ async fn load_simulation(name: String, model_dir: String) {
println!("PubKey Node {}: {}", node_id, s);
},
Err(e) => {
println!("{}", format!("Unable to get pub key: {}", e));
println!("Unable to get pub key: {}", e);
}
}
}
Expand All @@ -572,7 +572,7 @@ async fn load_simulation(name: String, model_dir: String) {
println!("Channels Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list channels: {}", e));
println!("Unable to list channels: {}", e);
}
}

Expand All @@ -581,7 +581,7 @@ async fn load_simulation(name: String, model_dir: String) {
println!("Channels Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to list channels: {}", e));
println!("Unable to list channels: {}", e);
}
}

Expand All @@ -590,7 +590,7 @@ async fn load_simulation(name: String, model_dir: String) {
println!("Wallet Balance Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -599,7 +599,7 @@ async fn load_simulation(name: String, model_dir: String) {
println!("Wallet Balance Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -608,7 +608,7 @@ async fn load_simulation(name: String, model_dir: String) {
println!("Channel Balance Node 0000: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand All @@ -617,7 +617,7 @@ async fn load_simulation(name: String, model_dir: String) {
println!("Channel Balance Node 0001: {}", s);
},
Err(e) => {
println!("{}", format!("Unable to get wallet balance: {}", e));
println!("Unable to get wallet balance: {}", e);
}
}

Expand Down
4 changes: 2 additions & 2 deletions blast_models/blast_ldk/blast_ldk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl BlastLdkServer {
// Set up the listening address for this node
let mut listen_addr_list: Vec<SocketAddress> = Vec::new();
let addr = format!("127.0.0.1:{}", port);
let rpcaddr = format!("127.0.0.1:{}", rpcport);
let _rpcaddr = format!("127.0.0.1:{}", rpcport);
let address = match SocketAddress::from_str(&addr) {
Ok(a) => a,
Err(_) => {
Expand Down Expand Up @@ -283,7 +283,7 @@ impl BlastLdkServer {
thread::sleep(Duration::from_secs(2));

// TODO: Once and RPC is added to LDK-node, fill in the config for that connection here so that SimLn will be able to connect and generate payments
let n = SimLnNode{id: node_id.clone(), address: rpcaddr, macaroon: String::from(""), cert: String::from("")};
let n = SimLnNode{id: node_id.clone(), address: String::from(""), macaroon: String::from(""), cert: String::from("")};

Ok((n, node))
}
Expand Down
Loading

0 comments on commit 4cf6e93

Please sign in to comment.