Document more TODOs as tickets (#1418)

Went through the TODOs, removed a bunch, which are outdated or nothing more than a regular comment, documented a bunch more as actual tickets and made them FIXMEs and unified their structure (`FIXME #TICKETNO DESC` for local tickets, `FIXME: DESC LINK` for external tickets) for easier in-editor support. Further more remove unnecessary remarks and related old code that I noticed in that instance.
This commit is contained in:
Benjamin Kampmann
2019-01-30 10:29:48 +01:00
committed by GitHub
parent d2cfd7b9dc
commit 15ae7cfef6
59 changed files with 65 additions and 142 deletions
-9
View File
@@ -67,34 +67,25 @@ impl trie_root::TrieStream for TrieStream {
fn append_leaf(&mut self, key: &[u8], value: &[u8]) {
self.buffer.extend(fuse_nibbles_node(key, true));
// OPTIMISATION: I'd like to do `hpe.encode_to(&mut self.buffer);` here; need an `impl<'a> Encode for impl Iterator<Item = u8> + 'a`?
value.encode_to(&mut self.buffer);
}
fn begin_branch(&mut self, maybe_value: Option<&[u8]>, has_children: impl Iterator<Item = bool>) {
// println!("[begin_branch] pushing BRANCH_NODE");
self.buffer.extend(&branch_node(maybe_value.is_some(), has_children));
// Push the value if one exists.
if let Some(value) = maybe_value {
value.encode_to(&mut self.buffer);
}
// println!("[begin_branch] buffer so far: {:#x?}", self.buffer);
}
fn append_extension(&mut self, key: &[u8]) {
self.buffer.extend(fuse_nibbles_node(key, false));
}
fn append_substream<H: Hasher>(&mut self, other: Self) {
let data = other.out();
// println!("[append_substream] START own buffer: {:x?}", self.buffer);
// println!("[append_substream] START other buffer: {:x?}", data);
match data.len() {
0...31 => {
// println!("[append_substream] appending data, because data.len() = {}", data.len());
data.encode_to(&mut self.buffer)
},
_ => {
// println!("[append_substream] would have hashed, because data.len() = {}", data.len());
// data.encode_to(&mut self.buffer)
// TODO: re-enable hashing before merging
H::hash(&data).as_ref().encode_to(&mut self.buffer)
}
}