mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
common: add programatic initialization of msat
This commit is contained in:
parent
898df57fa0
commit
a26665a421
@ -370,6 +370,16 @@ bool amount_msat_to_u32(struct amount_msat msat, u32 *millisatoshis)
|
||||
return true;
|
||||
}
|
||||
|
||||
void amount_msat_from_u64(struct amount_msat *msat, u64 millisatoshis)
|
||||
{
|
||||
msat->millisatoshis = millisatoshis;
|
||||
}
|
||||
|
||||
void amount_msat_from_sat_u64(struct amount_msat *msat, u64 satoshis)
|
||||
{
|
||||
msat->millisatoshis = satoshis * 1000;
|
||||
}
|
||||
|
||||
bool amount_msat_fee(struct amount_msat *fee,
|
||||
struct amount_msat amt,
|
||||
u32 fee_base_msat,
|
||||
|
@ -102,6 +102,10 @@ bool amount_msat_less_eq_sat(struct amount_msat msat, struct amount_sat sat);
|
||||
WARN_UNUSED_RESULT bool amount_msat_to_u32(struct amount_msat msat,
|
||||
u32 *millisatoshis);
|
||||
|
||||
/* Programatically initialize from various types */
|
||||
void amount_msat_from_u64(struct amount_msat *msat, u64 millisatoshis);
|
||||
void amount_msat_from_sat_u64(struct amount_msat *msat, u64 satoshis);
|
||||
|
||||
/* Common operation: what is the HTLC fee for given feerate? Can overflow! */
|
||||
WARN_UNUSED_RESULT bool amount_msat_fee(struct amount_msat *fee,
|
||||
struct amount_msat amt,
|
||||
|
Loading…
Reference in New Issue
Block a user