Skip to content

Commit 295dc0c

Browse files
authored
Merge pull request #552 from randomlogin/fix-empty-block-fees
Fix empty block fee rate calculation
2 parents fc209de + f1d4b17 commit 295dc0c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/client.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ 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
168+
.to_sat()
169+
.checked_div(weight.to_kwu_floor())
170+
.unwrap_or(0);
168171
Ok(FeeRate::from_sat_per_kwu(fee_rate))
169172
}
170173

0 commit comments

Comments
 (0)