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

Function wallet_network_events_first

wallet/wallet.c:7345–7389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7343}
7344
7345struct db_stmt *wallet_network_events_first(struct wallet *w,
7346 const struct node_id *specific_id,
7347 u64 liststart,
7348 u32 *listlimit)
7349{
7350 struct db_stmt *stmt;
7351
7352 if (specific_id) {
7353 stmt = db_prepare_v2(w->db,
7354 SQL("SELECT"
7355 " id"
7356 ", peer_id"
7357 ", type"
7358 ", reason"
7359 ", timestamp"
7360 ", duration_nsec"
7361 ", connect_attempted"
7362 " FROM network_events"
7363 " WHERE peer_id = ? AND id >= ?"
7364 " ORDER BY id"
7365 " LIMIT ?;"));
7366 db_bind_node_id(stmt, specific_id);
7367 } else {
7368 stmt = db_prepare_v2(w->db,
7369 SQL("SELECT"
7370 " id"
7371 ", peer_id"
7372 ", type"
7373 ", reason"
7374 ", timestamp"
7375 ", duration_nsec"
7376 ", connect_attempted"
7377 " FROM network_events"
7378 " WHERE id >= ?"
7379 " ORDER BY id"
7380 " LIMIT ?;"));
7381 }
7382 db_bind_u64(stmt, liststart);
7383 if (listlimit)
7384 db_bind_int(stmt, *listlimit);
7385 else
7386 db_bind_int(stmt, INT_MAX);
7387 db_query_prepared(stmt);
7388 return wallet_channel_moves_next(w, stmt);
7389}
7390
7391const char *network_event_name(enum network_event n)
7392{

Callers 1

json_listnetworkeventsFunction · 0.85

Calls 5

db_bind_node_idFunction · 0.85
db_bind_u64Function · 0.85
db_bind_intFunction · 0.85
db_query_preparedFunction · 0.85

Tested by

no test coverage detected