Skip to content

Commit

Permalink
Removed extraneous debug statements :
Browse files Browse the repository at this point in the history
  • Loading branch information
litch committed May 6, 2022
1 parent 98c27ad commit a6aa2f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
3 changes: 0 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,18 +568,15 @@ impl Default for NodeConfig {

impl NodeConfig {
pub fn path(&self) -> String {
dbg!("Looking up a path");
format!("{}/data/{}", self.data_dir, self.pubkey)
}

pub fn save(&mut self) {
dbg!("Trying to save");
fs::write(
self.path().clone(),
serde_json::to_string(&self).expect("failed to serialize config"),
)
.expect("failed to write config");
dbg!("Saved");
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/database/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl AdminDatabase {

pub fn create_node(&mut self, node: Node) -> Result<i64, Error> {
let mut statement = self.connection.prepare_cached("INSERT INTO nodes (external_id, username, alias, role, network, listen_addr, listen_port, pubkey, status) VALUES (:external_id, :username, :alias, :role, :network, :listen_addr, :listen_port, :pubkey, :status)")?;

statement.execute(named_params! {
":external_id": node.external_id,
":username": node.username,
Expand All @@ -361,7 +361,6 @@ impl AdminDatabase {
":pubkey": node.pubkey,
":status": node.status
})?;
dbg!("Wrote node to the database");

Ok(self.connection.last_insert_rowid())
}
Expand All @@ -372,7 +371,7 @@ impl AdminDatabase {
statement.execute(named_params! {
":blank": "",
})?;
dbg!("I deleted the node with no pubkey because it sucks!");

Ok(())
}

Expand All @@ -388,7 +387,7 @@ impl AdminDatabase {
":pubkey": node.pubkey,
":status": node.status
})?;
dbg!("Ok now I just wrote a node update. It probably has a pubkey");

Ok(())
}

Expand Down
11 changes: 3 additions & 8 deletions src/services/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ impl AdminService {
port
}
};

let mut node = {
let mut node = match role {
Role::Admin => Node::new_admin(
Expand All @@ -464,29 +464,24 @@ impl AdminService {
),
};
let mut database = self.database.lock().await;
dbg!("Locked the database!");

node.id = database.create_node(node.clone())
.map_err(|err| {
error!("Unable to create node in Sensei Database");
database.clear_pending_node();
err
})?;


dbg!("Created?");
node
};
dbg!("Node is created in the database");

let lightning_node = self.get_node(node.clone(), passphrase).await.unwrap();
dbg!("Ok, so wtf");
node.pubkey = lightning_node.node_info()?.node_pubkey;
dbg!("I have a pubkey even {:?}", node.pubkey.clone());

{
let mut database = self.database.lock().await;
database.update_node(node.clone())?;
}
dbg!("And now it's in the database (ffs)");

Ok((lightning_node, node))
}
Expand Down

0 comments on commit a6aa2f9

Please sign in to comment.