mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
rustfmt
This commit is contained in:
parent
8dfc7f3b2f
commit
94322c796c
3 changed files with 16 additions and 11 deletions
|
@ -367,16 +367,16 @@ fn validate_block_via_txhashset(b: &Block, ext: &mut txhashset::Extension) -> Re
|
|||
}
|
||||
|
||||
/// Officially adds the block to our chain.
|
||||
fn add_block(b: &Block, store: Arc<store::ChainStore>, batch: &mut store::Batch) -> Result<(), Error> {
|
||||
fn add_block(
|
||||
b: &Block,
|
||||
store: Arc<store::ChainStore>,
|
||||
batch: &mut store::Batch,
|
||||
) -> Result<(), Error> {
|
||||
batch
|
||||
.save_block(b)
|
||||
.map_err(|e| Error::StoreErr(e, "pipe save block".to_owned()))?;
|
||||
let bitmap = store.build_and_cache_block_input_bitmap(&b)?;
|
||||
batch
|
||||
.save_block_input_bitmap(
|
||||
&b.hash(),
|
||||
&bitmap
|
||||
)?;
|
||||
batch.save_block_input_bitmap(&b.hash(), &bitmap)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,6 @@ impl ChainStore {
|
|||
)
|
||||
}
|
||||
|
||||
|
||||
pub fn build_block_input_bitmap(&self, block: &Block) -> Result<Bitmap, Error> {
|
||||
let bitmap = block
|
||||
.inputs
|
||||
|
@ -353,8 +352,10 @@ impl<'a> Batch<'a> {
|
|||
}
|
||||
|
||||
pub fn save_block_input_bitmap(&self, bh: &Hash, bm: &Bitmap) -> Result<(), Error> {
|
||||
self.db
|
||||
.put(&to_key(BLOCK_INPUT_BITMAP_PREFIX, &mut bh.to_vec())[..], bm.serialize())
|
||||
self.db.put(
|
||||
&to_key(BLOCK_INPUT_BITMAP_PREFIX, &mut bh.to_vec())[..],
|
||||
bm.serialize(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn delete_block_input_bitmap(&self, bh: &Hash) -> Result<(), Error> {
|
||||
|
|
|
@ -343,7 +343,10 @@ where
|
|||
|
||||
match res {
|
||||
Err(e) => {
|
||||
debug!(LOGGER, "Error returned, discarding txhashset extension: {:?}", e);
|
||||
debug!(
|
||||
LOGGER,
|
||||
"Error returned, discarding txhashset extension: {:?}", e
|
||||
);
|
||||
trees.output_pmmr_h.backend.discard();
|
||||
trees.rproof_pmmr_h.backend.discard();
|
||||
trees.kernel_pmmr_h.backend.discard();
|
||||
|
@ -798,7 +801,8 @@ impl<'a> Extension<'a> {
|
|||
let rewind_rm_pos =
|
||||
input_pos_to_rewind(self.commit_index.clone(), block_header, head_header)?;
|
||||
if !rewind_rm_pos.0 {
|
||||
self.batch.save_block_input_bitmap(&head_header.hash(), &rewind_rm_pos.1)?;
|
||||
self.batch
|
||||
.save_block_input_bitmap(&head_header.hash(), &rewind_rm_pos.1)?;
|
||||
}
|
||||
|
||||
self.rewind_to_pos(
|
||||
|
|
Loading…
Reference in a new issue