Skip to content

Commit

Permalink
Add seed node as default peer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-L2L committed May 20, 2024
1 parent 2e58099 commit fb0c006
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ authors = [
"Nikita Chashchinskii <[email protected]>"
]
edition = "2021"
version = "0.8.6"
version = "0.8.7"

[workspace.dependencies.bip300301]
git = "https://github.com/Ash-L2L/bip300301.git"
rev = "64568dee7b89fe8c021226f10b17a18fe3386871"

[workspace.dependencies.rustreexo]
git = "https://github.com/Ash-L2L/rustreexo.git"
rev = "a3ac7d3ebe9749ebd0bb34c709e7616f83d573b3"
rev = "6e220fd89b33b60d9ab9099926683c3010a62ede"

[profile.release]
# lto = "fat"
16 changes: 15 additions & 1 deletion lib/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,21 @@ impl Net {
let active_peers = Arc::new(RwLock::new(HashMap::new()));
let mut rwtxn = env.write_txn()?;
let known_peers =
env.create_database(&mut rwtxn, Some("known_peers"))?;
match env.open_database(&rwtxn, Some("known_peers"))? {
Some(known_peers) => known_peers,
None => {
let known_peers =
env.create_database(&mut rwtxn, Some("known_peers"))?;
const SEED_NODE_ADDR: SocketAddr = SocketAddr::new(
std::net::IpAddr::V4(std::net::Ipv4Addr::new(
172, 105, 148, 135,
)),
3820,
);
known_peers.put(&mut rwtxn, &SEED_NODE_ADDR, &())?;
known_peers
}
};
rwtxn.commit()?;
let (peer_info_tx, peer_info_rx) = mpsc::unbounded();
let net = Net {
Expand Down

0 comments on commit fb0c006

Please sign in to comment.