common: add amount_msat_deduct / amount_msat_deduct_sub.
I added amount_msat_accumulate for the "a+=b" case, but I was struggling with a name for the subtractive equivalent. After some prompting, ChatGPT suggested deduct. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -657,9 +657,8 @@ static struct amount_msat calc_capacity(struct info *info,
|
||||
if (!short_channel_id_dir_eq(&info->reservations[i]->scidd, scidd))
|
||||
continue;
|
||||
/* We should never use more that we have! */
|
||||
if (!amount_msat_sub(&dynamic_capacity,
|
||||
dynamic_capacity,
|
||||
info->reservations[i]->amount))
|
||||
if (!amount_msat_deduct(&dynamic_capacity,
|
||||
info->reservations[i]->amount))
|
||||
abort();
|
||||
status_debug("... minus reservation %s",
|
||||
fmt_amount_msat(tmpctx, info->reservations[i]->amount));
|
||||
|
||||
Reference in New Issue
Block a user