amount: add 'is_zero' helper

convenience, mostly
This commit is contained in:
niftynei
2021-06-08 15:37:49 -05:00
committed by neil saitug
parent 3ae64efbe4
commit b1982f04be
5 changed files with 16 additions and 8 deletions

View File

@@ -357,6 +357,11 @@ bool amount_sat_eq(struct amount_sat a, struct amount_sat b)
return a.satoshis == b.satoshis;
}
bool amount_sat_zero(struct amount_sat a)
{
return a.satoshis == 0;
}
bool amount_msat_eq(struct amount_msat a, struct amount_msat b)
{
return a.millisatoshis == b.millisatoshis;

View File

@@ -94,6 +94,9 @@ struct amount_sat amount_sat_div(struct amount_sat sat, u64 div);
bool amount_sat_eq(struct amount_sat a, struct amount_sat b);
bool amount_msat_eq(struct amount_msat a, struct amount_msat b);
/* Is a zero? */
bool amount_sat_zero(struct amount_sat a);
/* Is a > b? */
bool amount_sat_greater(struct amount_sat a, struct amount_sat b);
bool amount_msat_greater(struct amount_msat a, struct amount_msat b);