From 5e1d8d6ad6e7d56cd406f538faf06adc437094ed Mon Sep 17 00:00:00 2001 From: niftynei Date: Thu, 11 Nov 2021 16:34:26 -0600 Subject: [PATCH] amount: helper for msat == 0 Shorthand for checking if value is zero --- common/amount.c | 5 +++++ common/amount.h | 1 + 2 files changed, 6 insertions(+) diff --git a/common/amount.c b/common/amount.c index bfe29e7a8..fa1870700 100644 --- a/common/amount.c +++ b/common/amount.c @@ -360,6 +360,11 @@ bool amount_sat_zero(struct amount_sat a) return a.satoshis == 0; } +bool amount_msat_zero(struct amount_msat a) +{ + return a.millisatoshis == 0; +} + bool amount_msat_eq(struct amount_msat a, struct amount_msat b) { return a.millisatoshis == b.millisatoshis; diff --git a/common/amount.h b/common/amount.h index 616318740..b7277d7ee 100644 --- a/common/amount.h +++ b/common/amount.h @@ -94,6 +94,7 @@ bool amount_msat_eq(struct amount_msat a, struct amount_msat b); /* Is a zero? */ bool amount_sat_zero(struct amount_sat a); +bool amount_msat_zero(struct amount_msat a); /* Is a > b? */ bool amount_sat_greater(struct amount_sat a, struct amount_sat b);