Skip to content

Commit bc49f2b

Browse files
committed
Fix empty block fee rate calculation
Previously could panic (and panicked!) if encountered an empty block.
1 parent fc209de commit bc49f2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl Requester {
164164
.map(|tx| tx.output.iter().map(|txout| txout.value).sum())
165165
.unwrap_or(Amount::ZERO);
166166
let block_fees = revenue.checked_sub(subsidy).unwrap_or(Amount::ZERO);
167-
let fee_rate = block_fees.to_sat() / weight.to_kwu_floor();
167+
let fee_rate = block_fees.to_sat().checked_div(weight.to_kwu_floor()).unwrap_or(0);
168168
Ok(FeeRate::from_sat_per_kwu(fee_rate))
169169
}
170170

0 commit comments

Comments
 (0)