mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 08:04:23 +01:00
bkpr: make sure there's always at least on difference in blockheights
We can't divide by zero, so make sure it's always 1 (with a small loss of precision for other cases, ce la vie)
This commit is contained in:
@@ -342,8 +342,8 @@ void json_add_channel_apy(struct json_stream *res,
|
||||
tal_fmt(apy, "%.4f%%", utilization * 100));
|
||||
}
|
||||
|
||||
blocks_elapsed = apy->end_blockheight - apy->start_blockheight;
|
||||
assert(blocks_elapsed > 0);
|
||||
/* Can't divide by zero */
|
||||
blocks_elapsed = apy->end_blockheight - apy->start_blockheight + 1;
|
||||
|
||||
/* APY (outbound) */
|
||||
ok = calc_apy(apy->fees_out, apy->total_start_bal,
|
||||
|
||||
Reference in New Issue
Block a user