Browse Source

wallet: Add missing description field to the invoices iteration

ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
2d1190d929
  1. 1
      CHANGELOG.md
  2. 16
      wallet/invoices.c

1
CHANGELOG.md

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- JSON API:`listnodes` has new field `global_features`. - JSON API:`listnodes` has new field `global_features`.
- Protocol: gossipd now deliberately delays spamming with `channel_update`. - Protocol: gossipd now deliberately delays spamming with `channel_update`.
- Config: `--conf` option to set config file. - Config: `--conf` option to set config file.
- JSON API: Added description to invoices and payments (#1740).
### Changed ### Changed

16
wallet/invoices.c

@ -14,6 +14,8 @@
#include <sqlite3.h> #include <sqlite3.h>
#include <string.h> #include <string.h>
#define INVOICE_TBL_FIELDS "state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description"
struct invoice_waiter { struct invoice_waiter {
/* Is this waiter already triggered? */ /* Is this waiter already triggered? */
bool triggered; bool triggered;
@ -475,11 +477,8 @@ bool invoices_iterate(struct invoices *invoices,
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
int res; int res;
if (!it->p) { if (!it->p) {
stmt = db_prepare(invoices->db, stmt = db_prepare(invoices->db, "SELECT " INVOICE_TBL_FIELDS
"SELECT state, payment_key, payment_hash" " FROM invoices;");
" , label, msatoshi, expiry_time, pay_index"
" , msatoshi_received, paid_timestamp, bolt11"
" FROM invoices;");
it->p = stmt; it->p = stmt;
} else } else
stmt = it->p; stmt = it->p;
@ -648,11 +647,8 @@ const struct invoice_details *invoices_get_details(const tal_t *ctx,
struct invoice_details *details; struct invoice_details *details;
stmt = db_prepare(invoices->db, stmt = db_prepare(invoices->db,
"SELECT state, payment_key, payment_hash" "SELECT " INVOICE_TBL_FIELDS
" , label, msatoshi, expiry_time, pay_index" " FROM invoices"
" , msatoshi_received, paid_timestamp, bolt11"
" , description"
" FROM invoices"
" WHERE id = ?;"); " WHERE id = ?;");
sqlite3_bind_int64(stmt, 1, invoice.id); sqlite3_bind_int64(stmt, 1, invoice.id);
result = sqlite3_step(stmt); result = sqlite3_step(stmt);

Loading…
Cancel
Save