MCPcopy Create free account
hub / github.com/ElementsProject/lightning / db_col_node_id_arr

Function db_col_node_id_arr

db/bindings.c:379–396  ·  view source on GitHub ↗

We don't assume sizeof(struct node_id) == sizeof(struct node_id.k), * otherwise this would simply be a call to db_col_arr! * Thanks ARM! */

Source from the content-addressed store, hash-verified

377 * otherwise this would simply be a call to db_col_arr!
378 * Thanks ARM! */
379struct node_id *db_col_node_id_arr(const tal_t *ctx, struct db_stmt *stmt,
380 const char *colname)
381{
382 size_t col = db_query_colnum(stmt, colname);
383 struct node_id *ret;
384 size_t n = db_column_bytes(stmt, col) / sizeof(ret->k);
385 const u8 *arr = db_column_blob(stmt, col);
386 assert(n * sizeof(ret->k) == (size_t)db_column_bytes(stmt, col));
387
388 if (db_column_is_null(stmt, col))
389 return NULL;
390
391 ret = tal_arr(ctx, struct node_id, n);
392 for (size_t i = 0; i < n; i++)
393 memcpy(ret[i].k, arr + i * sizeof(ret[i].k), sizeof(ret[i].k));
394
395 return ret;
396}
397
398void db_col_pubkey(struct db_stmt *stmt,
399 const char *colname,

Callers 1

payment_get_detailsFunction · 0.85

Calls 4

db_query_colnumFunction · 0.85
db_column_bytesFunction · 0.85
db_column_blobFunction · 0.85
db_column_is_nullFunction · 0.85

Tested by

no test coverage detected