Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp committed Oct 10, 2018
1 parent e640a07 commit f3ba4cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 1 addition & 4 deletions chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,7 @@ impl Chain {
}

// TODO - think about how to optimize this.
pub fn rebuild_sync_mmr(
&self,
header: &BlockHeader,
) -> Result<(), Error> {
pub fn rebuild_sync_mmr(&self, header: &BlockHeader) -> Result<(), Error> {
let mut txhashset = self.txhashset.write().unwrap();
let mut batch = self.store.batch()?;

Expand Down
11 changes: 7 additions & 4 deletions chain/src/txhashset/txhashset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,12 @@ impl<'a> HeaderExtension<'a> {
}

pub fn rewind(&mut self, header: &BlockHeader) -> Result<(), Error> {
debug!(LOGGER, "Rewind header extension to {} at {}", header.hash(), header.height);
debug!(
LOGGER,
"Rewind header extension to {} at {}",
header.hash(),
header.height
);

let header_pos = pmmr::insertion_to_pmmr_index(header.height + 1);
self.pmmr
Expand All @@ -650,9 +655,7 @@ impl<'a> HeaderExtension<'a> {
pub fn clear(&mut self) -> Result<(), Error> {
debug!(LOGGER, "Clear header extension.");

self.pmmr
.rewind(0)
.map_err(&ErrorKind::TxHashSetErr)?;
self.pmmr.rewind(0).map_err(&ErrorKind::TxHashSetErr)?;

Ok(())
}
Expand Down
5 changes: 4 additions & 1 deletion servers/src/grin/sync/header_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ impl HeaderSync {
self.chain.reset_sync_head(&header_head).unwrap();

// Rebuild the sync MMR to match our updates sync_head.
let header = self.chain.get_block_header(&header_head.last_block_h).unwrap();
let header = self
.chain
.get_block_header(&header_head.last_block_h)
.unwrap();
self.chain.rebuild_sync_mmr(&header).unwrap();

self.history_locators.clear();
Expand Down

0 comments on commit f3ba4cd

Please sign in to comment.