forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lightningd: move local invoice resolution into invoice.c function.
We're going to make it async, so start by moving the core code into invoice.c and having that directly call fail/success functions for the htlc. We add an extra check in fulfill_htlc() that the HTLC state is correct: that can't happen now, but may once we're async. Signed-off-by: Rusty Russell <[email protected]>
- Loading branch information
1 parent
aa00e26
commit 6630b99
Showing
7 changed files
with
118 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
#ifndef LIGHTNING_LIGHTNINGD_INVOICE_H | ||
#define LIGHTNING_LIGHTNINGD_INVOICE_H | ||
#include "config.h" | ||
#include <bitcoin/preimage.h> | ||
#include <ccan/crypto/sha256/sha256.h> | ||
#include <ccan/list/list.h> | ||
#include <ccan/tal/tal.h> | ||
#include <wire/gen_onion_wire.h> | ||
|
||
struct amount_msat; | ||
struct htlc_in; | ||
struct lightningd; | ||
struct sha256; | ||
|
||
/** | ||
* invoice_try_pay - process payment for this payment_hash, amount msat. | ||
* @ld: lightningd | ||
* @hin: the input HTLC which is offering to pay. | ||
* @payment_hash: hash of preimage they want. | ||
* @msat: amount they offer to pay. | ||
* | ||
* Either calls fulfill_htlc() or fail_htlcs(). | ||
*/ | ||
void invoice_try_pay(struct lightningd *ld, | ||
struct htlc_in *hin, | ||
const struct sha256 *payment_hash, | ||
const struct amount_msat msat); | ||
|
||
#endif /* LIGHTNING_LIGHTNINGD_INVOICE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters