Skip to content

Commit 7341a4b

Browse files
committed
chore: cargo fmt
1 parent 7bd1ae8 commit 7341a4b

File tree

2 files changed

+38
-11
lines changed

2 files changed

+38
-11
lines changed

stackslib/src/net/api/getsortition.rs

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ use {serde, serde_json};
2929

3030
use crate::chainstate::burn::db::sortdb::SortitionDB;
3131
use crate::chainstate::burn::BlockSnapshot;
32-
use crate::chainstate::nakamoto::{NakamotoBlock, NakamotoChainState, NakamotoStagingBlocksConn};
33-
use crate::chainstate::nakamoto::StacksDBIndexed;
32+
use crate::chainstate::nakamoto::{
33+
NakamotoBlock, NakamotoChainState, NakamotoStagingBlocksConn, StacksDBIndexed,
34+
};
3435
use crate::chainstate::stacks::db::StacksChainState;
3536
use crate::chainstate::stacks::Error as ChainError;
3637
use crate::net::api::getblock_v3::NakamotoBlockStream;
@@ -157,9 +158,11 @@ impl GetSortitionHandler {
157158
sortition_sn: BlockSnapshot,
158159
sortdb: &SortitionDB,
159160
chainstate: &mut StacksChainState,
160-
tip: &StacksBlockId
161+
tip: &StacksBlockId,
161162
) -> Result<SortitionInfo, ChainError> {
162-
let is_shadow = chainstate.nakamoto_blocks_db().is_shadow_tenure(&sortition_sn.consensus_hash)?;
163+
let is_shadow = chainstate
164+
.nakamoto_blocks_db()
165+
.is_shadow_tenure(&sortition_sn.consensus_hash)?;
163166
let (miner_pk_hash160, stacks_parent_ch, committed_block_hash, last_sortition_ch) =
164167
if !sortition_sn.sortition && !is_shadow {
165168
let handle = sortdb.index_handle(&sortition_sn.sortition_id);
@@ -168,13 +171,27 @@ impl GetSortitionHandler {
168171
(None, None, None, Some(last_sortition.consensus_hash))
169172
} else if !sortition_sn.sortition && is_shadow {
170173
// this is a shadow tenure.
171-
let parent_tenure_ch = chainstate.index_conn().get_parent_tenure_consensus_hash(tip, &sortition_sn.consensus_hash)?
174+
let parent_tenure_ch = chainstate
175+
.index_conn()
176+
.get_parent_tenure_consensus_hash(tip, &sortition_sn.consensus_hash)?
172177
.ok_or_else(|| DBError::NotFoundError)?;
173-
174-
let parent_tenure_start_header = NakamotoChainState::get_nakamoto_tenure_start_block_header(&mut chainstate.index_conn(), tip, &parent_tenure_ch)?
178+
179+
let parent_tenure_start_header =
180+
NakamotoChainState::get_nakamoto_tenure_start_block_header(
181+
&mut chainstate.index_conn(),
182+
tip,
183+
&parent_tenure_ch,
184+
)?
175185
.ok_or_else(|| DBError::NotFoundError)?;
176186

177-
(Some(Hash160([0x00; 20])), Some(parent_tenure_ch.clone()), Some(BlockHeaderHash(parent_tenure_start_header.index_block_hash().0)), Some(parent_tenure_ch))
187+
(
188+
Some(Hash160([0x00; 20])),
189+
Some(parent_tenure_ch.clone()),
190+
Some(BlockHeaderHash(
191+
parent_tenure_start_header.index_block_hash().0,
192+
)),
193+
Some(parent_tenure_ch),
194+
)
178195
} else {
179196
let block_commit = SortitionDB::get_block_commit(sortdb.conn(), &sortition_sn.winning_block_txid, &sortition_sn.sortition_id)?
180197
.ok_or_else(|| {
@@ -324,7 +341,12 @@ impl RPCRequestHandler for GetSortitionHandler {
324341
}
325342
};
326343
let sortition_sn = query_result?.ok_or_else(|| ChainError::NoSuchBlockError)?;
327-
Self::get_sortition_info(sortition_sn, sortdb, chainstate, &network.stacks_tip.block_id())
344+
Self::get_sortition_info(
345+
sortition_sn,
346+
sortdb,
347+
chainstate,
348+
&network.stacks_tip.block_id(),
349+
)
328350
});
329351

330352
let block = match result {
@@ -358,7 +380,12 @@ impl RPCRequestHandler for GetSortitionHandler {
358380
&last_sortition_ch,
359381
)?
360382
.ok_or_else(|| ChainError::NoSuchBlockError)?;
361-
Self::get_sortition_info(last_sortition_sn, sortdb, chainstate, &network.stacks_tip.block_id())
383+
Self::get_sortition_info(
384+
last_sortition_sn,
385+
sortdb,
386+
chainstate,
387+
&network.stacks_tip.block_id(),
388+
)
362389
});
363390
let last_block = match result {
364391
Ok(block) => block,

stackslib/src/net/httpcore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ impl StacksHttp {
11991199
Err(NetError::Http(e)) => {
12001200
debug!("RPC handler for {} failed: {:?}", decoded_path, &e);
12011201
return StacksHttpResponse::new_error(&request_preamble, &*e.into_http_error())
1202-
.try_into_contents()
1202+
.try_into_contents();
12031203
}
12041204
Err(e) => {
12051205
warn!("Irrecoverable error when handling request"; "path" => %request_preamble.path_and_query_str, "error" => %e);

0 commit comments

Comments
 (0)