paymod: Parse and store the waitsendpay result

This is necessary so we can later aggregate across an entire tree of attempts
and report success or failure to the RPC caller.
This commit is contained in:
Christian Decker
2020-05-14 20:22:40 +02:00
parent 6fb81bf203
commit 4fec969062
2 changed files with 92 additions and 7 deletions

View File

@@ -46,9 +46,23 @@ struct createonion_response {
struct secret *shared_secrets;
};
/* States returned by listsendpays, waitsendpay, etc. */
enum payment_result_state {
PAYMENT_PENDING,
PAYMENT_COMPLETE,
PAYMENT_FAILED,
};
/* A parsed version of the possible outcomes that a sendpay / payment may
* result in. */
* result in. It excludes the redundant fields such as payment_hash and partid
* which are already present in the `struct payment` itself. */
struct payment_result {
/* DB internal id */
u64 id;
u32 partid;
enum payment_result_state state;
struct amount_msat amount_sent;
struct preimage *payment_preimage;
};
/* Relevant information about a local channel so we can exclude them early. */
@@ -142,6 +156,8 @@ struct payment {
struct payment_modifier **modifiers;
void **modifier_data;
int current_modifier;
struct payment_result *result;
};
struct payment_modifier {