Makefile: check for direct amount_sat/amount_msat access.

We need to do it in various places, but we shouldn't do it lightly:
the primitives are there to help us get overflow handling correct.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-02-21 14:15:56 +10:30
parent 28f5da7b2f
commit 38e7d19dd5
22 changed files with 51 additions and 44 deletions

View File

@@ -335,7 +335,7 @@ void json_add_amount_msat(struct json_stream *result,
const char *rawfieldname,
const char *msatfieldname)
{
json_add_u64(result, rawfieldname, msat.millisatoshis);
json_add_u64(result, rawfieldname, msat.millisatoshis); /* Raw: low-level helper */
json_add_member(result, msatfieldname, "\"%s\"",
type_to_string(tmpctx, struct amount_msat, &msat));
}
@@ -346,7 +346,7 @@ void json_add_amount_sat(struct json_stream *result,
const char *msatfieldname)
{
struct amount_msat msat;
json_add_u64(result, rawfieldname, sat.satoshis);
json_add_u64(result, rawfieldname, sat.satoshis); /* Raw: low-level helper */
if (amount_sat_to_msat(&msat, sat))
json_add_member(result, msatfieldname, "\"%s\"",
type_to_string(tmpctx, struct amount_msat, &msat));