Put the next network event into the db */
| 7465 | |
| 7466 | /* Put the next network event into the db */ |
| 7467 | void wallet_save_network_event(struct lightningd *ld, |
| 7468 | const struct node_id *peer_id, |
| 7469 | enum network_event etype, |
| 7470 | const char *reason, |
| 7471 | u64 duration_nsec, |
| 7472 | bool connect_attempted) |
| 7473 | { |
| 7474 | u64 id; |
| 7475 | struct db_stmt *stmt; |
| 7476 | |
| 7477 | stmt = db_prepare_v2(ld->wallet->db, |
| 7478 | SQL("INSERT INTO network_events (" |
| 7479 | " id," |
| 7480 | " peer_id," |
| 7481 | " type, " |
| 7482 | " timestamp," |
| 7483 | " reason," |
| 7484 | " duration_nsec," |
| 7485 | " connect_attempted) VALUES " |
| 7486 | "(?, ?, ?, ?, ?, ?, ?);")); |
| 7487 | id = network_event_index_created(ld, etype, peer_id); |
| 7488 | db_bind_u64(stmt, id); |
| 7489 | db_bind_node_id(stmt, peer_id); |
| 7490 | db_bind_int(stmt, network_event_in_db(etype)); |
| 7491 | db_bind_u64(stmt, clock_time().ts.tv_sec); |
| 7492 | if (reason) |
| 7493 | db_bind_text(stmt, reason); |
| 7494 | else |
| 7495 | db_bind_null(stmt); |
| 7496 | db_bind_u64(stmt, duration_nsec); |
| 7497 | db_bind_int(stmt, connect_attempted); |
| 7498 | db_exec_prepared_v2(take(stmt)); |
| 7499 | } |
| 7500 | |
| 7501 | bool wallet_network_event_delete(struct wallet *w, u64 created_index) |
| 7502 | { |
nothing calls this directly
no test coverage detected