Skip to content

Commit 8a38889

Browse files
committed
rust fmt
1 parent d41b6a8 commit 8a38889

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

stackslib/src/chainstate/burn/db/sortdb.rs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,10 @@ pub trait SortitionHandle {
10961096
/// descends from `key.1`
10971097
///
10981098
/// If it does, return the cached entry
1099-
fn descendancy_cache_get(cache: &mut MutexGuard<'_, LruCache<(SortitionId, BlockHeaderHash), bool>>, key: &(SortitionId, BlockHeaderHash)) -> Option<bool> {
1099+
fn descendancy_cache_get(
1100+
cache: &mut MutexGuard<'_, LruCache<(SortitionId, BlockHeaderHash), bool>>,
1101+
key: &(SortitionId, BlockHeaderHash),
1102+
) -> Option<bool> {
11001103
match cache.get(key) {
11011104
Ok(result) => result,
11021105
// cache is broken, create a new one
@@ -1110,7 +1113,11 @@ pub trait SortitionHandle {
11101113

11111114
/// Cache the result of the descendancy check on whether or not the winning block in `key.0`
11121115
/// descends from `key.1`
1113-
fn descendancy_cache_put(cache: &mut MutexGuard<'_, LruCache<(SortitionId, BlockHeaderHash), bool>>, key: (SortitionId, BlockHeaderHash), is_descended: bool) {
1116+
fn descendancy_cache_put(
1117+
cache: &mut MutexGuard<'_, LruCache<(SortitionId, BlockHeaderHash), bool>>,
1118+
key: (SortitionId, BlockHeaderHash),
1119+
is_descended: bool,
1120+
) {
11141121
if let Err(e) = cache.insert_clean(key, is_descended) {
11151122
error!("SortitionDB's descendant cache errored. Will continue operation with cleared cache"; "err" => %e);
11161123
**cache = LruCache::new(DESCENDANCY_CACHE_SIZE);
@@ -1155,7 +1162,11 @@ pub trait SortitionHandle {
11551162
match Self::descendancy_cache_get(&mut cache, &cache_check_key) {
11561163
Some(result) => {
11571164
if sn.sortition_id != top_sortition_id {
1158-
Self::descendancy_cache_put(&mut cache, (top_sortition_id, cache_check_key.1), result);
1165+
Self::descendancy_cache_put(
1166+
&mut cache,
1167+
(top_sortition_id, cache_check_key.1),
1168+
result,
1169+
);
11591170
}
11601171
return Ok(result);
11611172
}
@@ -1164,11 +1175,19 @@ pub trait SortitionHandle {
11641175
}
11651176

11661177
if !sn.sortition {
1167-
Self::descendancy_cache_put(&mut cache, (top_sortition_id, cache_check_key.1), false);
1178+
Self::descendancy_cache_put(
1179+
&mut cache,
1180+
(top_sortition_id, cache_check_key.1),
1181+
false,
1182+
);
11681183
return Ok(false);
11691184
}
11701185
if &sn.winning_stacks_block_hash == potential_ancestor {
1171-
Self::descendancy_cache_put(&mut cache, (top_sortition_id, cache_check_key.1), true);
1186+
Self::descendancy_cache_put(
1187+
&mut cache,
1188+
(top_sortition_id, cache_check_key.1),
1189+
true,
1190+
);
11721191
return Ok(true);
11731192
}
11741193

@@ -1204,7 +1223,11 @@ pub trait SortitionHandle {
12041223
}
12051224
}
12061225
}
1207-
Self::descendancy_cache_put(&mut cache, (top_sortition_id, potential_ancestor.clone()), false);
1226+
Self::descendancy_cache_put(
1227+
&mut cache,
1228+
(top_sortition_id, potential_ancestor.clone()),
1229+
false,
1230+
);
12081231
return Ok(false);
12091232
}
12101233
}

0 commit comments

Comments
 (0)