Skip to content

Commit

Permalink
Return early when no receipts to prove
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Mar 27, 2023
1 parent 2819043 commit b8a6069
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion consensus/src/consensus/consensus_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl<N: Network> ConsensusProxy<N> {
min_peers: usize,
max: Option<u16>,
) -> Result<Vec<ExtendedTransaction>, RequestError> {
let receipts = self
let receipts: Vec<_> = self
.request_transaction_receipts_by_address(address, min_peers, max)
.await?
.into_iter()
Expand All @@ -149,6 +149,10 @@ impl<N: Network> ConsensusProxy<N> {
.map(|(hash, block_number)| (hash, Some(block_number)))
.collect();

if receipts.is_empty() {
return Ok(vec![]);
}

self.prove_transactions_from_receipts(receipts, min_peers)
.await
}
Expand Down

0 comments on commit b8a6069

Please sign in to comment.