mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
json-rpc: Retrieve the invoice description in listinvoices
This commit is contained in:
committed by
Rusty Russell
parent
7f45947523
commit
259a69994d
@@ -48,6 +48,10 @@ static void json_add_invoice(struct json_result *response,
|
||||
inv->msatoshi_received);
|
||||
json_add_u64(response, "paid_at", inv->paid_timestamp);
|
||||
}
|
||||
|
||||
if (inv->description)
|
||||
json_add_string(response, "description", inv->description);
|
||||
|
||||
json_add_u64(response, "expires_at", inv->expiry_time);
|
||||
|
||||
json_object_end(response);
|
||||
|
||||
@@ -114,7 +114,14 @@ static void wallet_stmt2invoice_details(const tal_t *ctx,
|
||||
dtl->paid_timestamp = sqlite3_column_int64(stmt, 8);
|
||||
}
|
||||
|
||||
dtl->bolt11 = tal_strndup(ctx, sqlite3_column_blob(stmt, 9), sqlite3_column_bytes(stmt, 9));
|
||||
dtl->bolt11 = tal_strndup(ctx, sqlite3_column_blob(stmt, 9),
|
||||
sqlite3_column_bytes(stmt, 9));
|
||||
|
||||
if (sqlite3_column_type(stmt, 10) != SQLITE_NULL)
|
||||
dtl->description = tal_strdup(
|
||||
ctx, (const char *)sqlite3_column_text(stmt, 10));
|
||||
else
|
||||
dtl->description = NULL;
|
||||
}
|
||||
|
||||
struct invoices *invoices_new(const tal_t *ctx,
|
||||
@@ -643,6 +650,7 @@ void invoices_get_details(const tal_t *ctx,
|
||||
"SELECT state, payment_key, payment_hash"
|
||||
" , label, msatoshi, expiry_time, pay_index"
|
||||
" , msatoshi_received, paid_timestamp, bolt11"
|
||||
" , description"
|
||||
" FROM invoices"
|
||||
" WHERE id = ?;");
|
||||
sqlite3_bind_int64(stmt, 1, invoice.id);
|
||||
|
||||
Reference in New Issue
Block a user