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

Function payment_store

lightningd/pay.c:517–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517void payment_store(struct lightningd *ld, struct wallet_payment *payment TAKES)
518{
519 struct sendpay_command *pc;
520 struct sendpay_command *next;
521 /* Need to remember here otherwise wallet_payment_store will free us. */
522 bool ptaken = taken(payment);
523
524 wallet_payment_store(ld->wallet, payment);
525
526 /* Trigger any sendpay commands waiting for the store to occur. */
527 list_for_each_safe(&ld->sendpay_commands, pc, next, list) {
528 if (!sha256_eq(&payment->payment_hash, &pc->payment_hash))
529 continue;
530
531 /* Deletes from list, frees pc */
532 json_sendpay_in_progress(pc->cmd, payment);
533 }
534
535 if (ptaken)
536 tal_free(payment);
537}
538
539void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
540 const char *localfail)

Callers 2

payment_failedFunction · 0.70
update_out_htlcFunction · 0.70

Calls 4

takenFunction · 0.85
wallet_payment_storeFunction · 0.85
json_sendpay_in_progressFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected