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

Function json_add_invoice_fields

plugins/offers.c:1319–1369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317}
1318
1319static bool json_add_invoice_fields(struct command *cmd,
1320 struct json_stream *js,
1321 struct blinded_path **invoice_paths,
1322 struct blinded_payinfo **invoice_blindedpay,
1323 const u64 *invoice_created_at,
1324 const u32 *invoice_relative_expiry,
1325 const struct sha256 *invoice_payment_hash,
1326 const u64 *invoice_amount,
1327 struct fallback_address **invoice_fallbacks,
1328 const u8 *invoice_features,
1329 const struct pubkey *invoice_node_id,
1330 const struct bitcoin_blkid *invreq_chain,
1331 const u64 *invoice_recurrence_basetime)
1332{
1333 bool valid = true;
1334
1335 if (invoice_paths)
1336 valid &= json_add_blinded_paths(cmd, js, "invoice_paths",
1337 invoice_paths, invoice_blindedpay);
1338
1339 if (invoice_created_at)
1340 json_add_u64(js, "invoice_created_at", *invoice_created_at);
1341
1342 if (invoice_relative_expiry)
1343 json_add_u32(js, "invoice_relative_expiry",
1344 *invoice_relative_expiry);
1345
1346 if (invoice_payment_hash)
1347 json_add_sha256(js, "invoice_payment_hash",
1348 invoice_payment_hash);
1349
1350 if (invoice_amount)
1351 json_add_amount_msat(js, "invoice_amount_msat",
1352 amount_msat(*invoice_amount));
1353
1354 if (invoice_fallbacks)
1355 valid &= json_add_fallbacks(js, invreq_chain,
1356 invoice_fallbacks);
1357
1358 if (invoice_features)
1359 json_add_hex_talarr(js, "invoice_features", invoice_features);
1360
1361 if (invoice_node_id)
1362 json_add_pubkey(js, "invoice_node_id", invoice_node_id);
1363
1364 if (invoice_recurrence_basetime)
1365 json_add_u64(js, "invoice_recurrence_basetime",
1366 *invoice_recurrence_basetime);
1367
1368 return valid;
1369}
1370
1371static void json_add_b12_invoice(struct command *cmd,
1372 struct json_stream *js,

Callers 2

json_add_b12_invoiceFunction · 0.70
json_add_payer_proofFunction · 0.70

Calls 9

json_add_blinded_pathsFunction · 0.85
json_add_u64Function · 0.85
json_add_u32Function · 0.85
json_add_sha256Function · 0.85
json_add_amount_msatFunction · 0.85
json_add_fallbacksFunction · 0.85
json_add_hex_talarrFunction · 0.85
json_add_pubkeyFunction · 0.85
amount_msatClass · 0.70

Tested by

no test coverage detected