projects
/
dnsseed-rust
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b252117
)
Preallocate the header maps
author
Matt Corallo
<git@bluematt.me>
Tue, 21 May 2019 15:19:06 +0000
(11:19 -0400)
committer
Matt Corallo
<git@bluematt.me>
Tue, 21 May 2019 15:19:06 +0000
(11:19 -0400)
src/main.rs
patch
|
blob
|
history
diff --git
a/src/main.rs
b/src/main.rs
index e040b95e7913ff1c51c7839a2d155a78c9490931..be4c8fcfd07d32b52dd0f506f9b9f905a39ed914 100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-310,8
+310,8
@@
fn main() {
return;
}
return;
}
- unsafe { HEADER_MAP = Some(Box::new(Mutex::new(HashMap::
new(
)))) };
- unsafe { HEIGHT_MAP = Some(Box::new(Mutex::new(HashMap::
new(
)))) };
+ unsafe { HEADER_MAP = Some(Box::new(Mutex::new(HashMap::
with_capacity(600000
)))) };
+ unsafe { HEIGHT_MAP = Some(Box::new(Mutex::new(HashMap::
with_capacity(600000
)))) };
unsafe { HEADER_MAP.as_ref().unwrap() }.lock().unwrap().insert(genesis_block(Network::Bitcoin).bitcoin_hash(), 0);
unsafe { HEIGHT_MAP.as_ref().unwrap() }.lock().unwrap().insert(0, genesis_block(Network::Bitcoin).bitcoin_hash());
unsafe { HIGHEST_HEADER = Some(Box::new(Mutex::new((genesis_block(Network::Bitcoin).bitcoin_hash(), 0)))) };
unsafe { HEADER_MAP.as_ref().unwrap() }.lock().unwrap().insert(genesis_block(Network::Bitcoin).bitcoin_hash(), 0);
unsafe { HEIGHT_MAP.as_ref().unwrap() }.lock().unwrap().insert(0, genesis_block(Network::Bitcoin).bitcoin_hash());
unsafe { HIGHEST_HEADER = Some(Box::new(Mutex::new((genesis_block(Network::Bitcoin).bitcoin_hash(), 0)))) };