MCPcopy Create free account
hub / github.com/ElementsProject/lightning / from_numbers

Function from_numbers

common/amount.c:175–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175static bool from_numbers(u64 *res,
176 const char *s1, size_t len1, int tens_factor,
177 const char *s2, size_t len2)
178{
179 u64 p1, p2;
180 if (len2 > tens_factor)
181 return false;
182
183 if (!from_number(&p1, s1, len1, tens_factor)
184 || !from_number(&p2, s2, len2, tens_factor - len2))
185 return false;
186
187 if (add_overflows_u64(p1, p2))
188 return false;
189
190 *res = p1 + p2;
191 return true;
192}
193
194/* Valid strings:
195 * [0-9]+ => millisatoshi.

Callers 2

parse_amount_msatFunction · 0.85
parse_amount_satFunction · 0.85

Calls 2

from_numberFunction · 0.85
add_overflows_u64Function · 0.85

Tested by

no test coverage detected