MCPcopy Create free account
hub / github.com/PacktPublishing/Rust-for-Blockchain-Application-Development / run

Method run

chapter 4/server.rs:48–66  ·  view source on GitHub ↗
(&self, addr: &str)

Source from the content-addressed store, hash-verified

46 }
47
48 pub fn run(&self, addr: &str) {
49 let listener = TcpListener::bind(addr).unwrap();
50
51 if addr.eq(CENTERAL_NODE) == false {
52 let best_height = self.blockchain.get_best_height();
53 send_version(CENTERAL_NODE, best_height);
54 }
55 for stream in listener.incoming() {
56 let blockchain = self.blockchain.clone();
57 thread::spawn(|| match stream {
58 Ok(stream) => {
59 ...
60 }
61 Err(e) => {
62 ...
63 }
64 });
65 }
66 }
67}
68
69#[derive(Debug, Serialize, Deserialize)]

Callers

nothing calls this directly

Calls 2

send_versionFunction · 0.70
get_best_heightMethod · 0.45

Tested by

no test coverage detected