lightningd: expose created_index and updated_index fields.

If you miss a wait event, you can catch up by doing listinvoices and
getting the max of these fields.  It's also a good debugging clue.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-07-22 20:29:17 +09:30
parent 284262d006
commit d25a8ca0fd
27 changed files with 559 additions and 325 deletions

View File

@@ -79,6 +79,9 @@ static void json_add_invoice_fields(struct json_stream *response,
tinv->invreq_payer_note,
tal_bytelen(tinv->invreq_payer_note));
}
json_add_u64(response, "created_index", inv->created_index);
if (inv->updated_index)
json_add_u64(response, "updated_index", inv->updated_index);
}
static void json_add_invoice(struct json_stream *response,
@@ -882,6 +885,7 @@ invoice_complete(struct invoice_info *info,
json_add_string(response, "bolt11", details->invstring);
invoice_secret(&details->r, &payment_secret);
json_add_secret(response, "payment_secret", &payment_secret);
json_add_u64(response, "created_index", details->created_index);
notify_invoice_creation(info->cmd->ld, info->b11->msat,
info->payment_preimage, info->label);

View File

@@ -39,6 +39,8 @@ struct invoice_details {
u8 *features;
/* The offer this refers to, if any. */
struct sha256 *local_offer_id;
/* Index values */
u64 created_index, updated_index;
};
/**