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

Function invoice_check_onchain_payment

lightningd/invoice.c:956–979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954}
955
956void invoice_check_onchain_payment(struct lightningd *ld,
957 const u8 *scriptPubKey,
958 struct amount_sat sat,
959 const struct bitcoin_outpoint *outpoint)
960{
961 u64 inv_dbid;
962 const struct invoice_details *details;
963 struct amount_msat msat;
964 if (!amount_sat_to_msat(&msat, sat))
965 abort();
966 /* Does this onchain payment fulfill an invoice? */
967 if(!invoices_find_by_fallback_script(ld->wallet->invoices, &inv_dbid, scriptPubKey)) {
968 return;
969 }
970
971 details = invoices_get_details(tmpctx, ld->wallet->invoices, inv_dbid);
972
973 if (amount_msat_less(msat, *details->msat)) {
974 // notify_underpaid_onchain_invoice();
975 return;
976 }
977
978 invoice_try_pay(ld, NULL, details, msat, outpoint);
979}
980
981/* Since this is a dev-only option, we will crash if dev-routes is not
982 * an array-of-arrays-of-correct-items. */

Callers 1

filter_block_txsFunction · 0.85

Calls 6

abortFunction · 0.85
invoice_try_payFunction · 0.85
amount_sat_to_msatFunction · 0.50
invoices_get_detailsFunction · 0.50
amount_msat_lessFunction · 0.50

Tested by

no test coverage detected