We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b14cc4 commit c6ae928Copy full SHA for c6ae928
lightning-invoice/src/lib.rs
@@ -1068,9 +1068,10 @@ impl RawBolt11Invoice {
1068
find_all_extract!(self.known_tagged_fields(), TaggedField::PrivateRoute(ref x), x).collect()
1069
}
1070
1071
+ /// Returns `None` if no amount is set or on overflow.
1072
pub fn amount_pico_btc(&self) -> Option<u64> {
- self.hrp.raw_amount.map(|v| {
1073
- v * self.hrp.si_prefix.as_ref().map_or(1_000_000_000_000, |si| { si.multiplier() })
+ self.hrp.raw_amount.and_then(|v| {
1074
+ v.checked_mul(self.hrp.si_prefix.as_ref().map_or(1_000_000_000_000, |si| { si.multiplier() }))
1075
})
1076
1077
0 commit comments