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

Function from_numbers

common/amount.c:162–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162static bool from_numbers(u64 *res,
163 const char *s1, size_t len1, int tens_factor,
164 const char *s2, size_t len2)
165{
166 u64 p1, p2;
167 if (len2 > tens_factor)
168 return false;
169
170 if (!from_number(&p1, s1, len1, tens_factor)
171 || !from_number(&p2, s2, len2, tens_factor - len2))
172 return false;
173
174 if (add_overflows_u64(p1, p2))
175 return false;
176
177 *res = p1 + p2;
178 return true;
179}
180
181/* Valid strings:
182 * [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