Refactor compact block body (#1394)

* introduce CompactBlockBody

* rustfmt

* implement From<Block> for CompactBlock

* rustfmt

* remove debug logging

* wip

* rustfmt
This commit is contained in:
Antioch Peverell
2018-08-22 20:19:37 +01:00
committed by GitHub
parent 105bfacaa6
commit 7dfca6077c
14 changed files with 424 additions and 264 deletions
+1 -1
View File
@@ -619,7 +619,7 @@ impl BlockHandler {
fn get_compact_block(&self, h: &Hash) -> Result<CompactBlockPrintable, Error> {
let block = w(&self.chain).get_block(h).context(ErrorKind::NotFound)?;
Ok(CompactBlockPrintable::from_compact_block(
&block.as_compact_block(),
&block.into(),
w(&self.chain),
))
}
+3 -3
View File
@@ -601,12 +601,12 @@ impl CompactBlockPrintable {
) -> CompactBlockPrintable {
let block = chain.get_block(&cb.hash()).unwrap();
let out_full = cb
.out_full
.out_full()
.iter()
.map(|x| OutputPrintable::from_output(x, chain.clone(), Some(&block.header), false))
.collect();
let kern_full = cb
.kern_full
.kern_full()
.iter()
.map(|x| TxKernelPrintable::from_txkernel(x))
.collect();
@@ -614,7 +614,7 @@ impl CompactBlockPrintable {
header: BlockHeaderPrintable::from_header(&cb.header),
out_full,
kern_full,
kern_ids: cb.kern_ids.iter().map(|x| x.to_hex()).collect(),
kern_ids: cb.kern_ids().iter().map(|x| x.to_hex()).collect(),
}
}
}