| 954 | } |
| 955 | |
| 956 | void 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. */ |
no test coverage detected