Put the next network event into the db */
| 7525 | |
| 7526 | /* Put the next network event into the db */ |
| 7527 | void wallet_save_network_event(struct lightningd *ld, |
| 7528 | const struct node_id *peer_id, |
| 7529 | enum network_event etype, |
| 7530 | const char *reason, |
| 7531 | u64 duration_nsec, |
| 7532 | bool connect_attempted) |
| 7533 | { |
| 7534 | u64 id; |
| 7535 | struct db_stmt *stmt; |
| 7536 | |
| 7537 | stmt = db_prepare_v2(ld->wallet->db, |
| 7538 | SQL("INSERT INTO network_events (" |
| 7539 | " id," |
| 7540 | " peer_id," |
| 7541 | " type, " |
| 7542 | " timestamp," |
| 7543 | " reason," |
| 7544 | " duration_nsec," |
| 7545 | " connect_attempted) VALUES " |
| 7546 | "(?, ?, ?, ?, ?, ?, ?);")); |
| 7547 | id = network_event_index_created(ld, etype, peer_id); |
| 7548 | db_bind_u64(stmt, id); |
| 7549 | db_bind_node_id(stmt, peer_id); |
| 7550 | db_bind_int(stmt, network_event_in_db(etype)); |
| 7551 | db_bind_u64(stmt, clock_time().ts.tv_sec); |
| 7552 | if (reason) |
| 7553 | db_bind_text(stmt, reason); |
| 7554 | else |
| 7555 | db_bind_null(stmt); |
| 7556 | db_bind_u64(stmt, duration_nsec); |
| 7557 | db_bind_int(stmt, connect_attempted); |
| 7558 | db_exec_prepared_v2(take(stmt)); |
| 7559 | } |
| 7560 | |
| 7561 | bool wallet_network_event_delete(struct wallet *w, u64 created_index) |
| 7562 | { |
nothing calls this directly
no test coverage detected