Put the next network event into the db */
| 7502 | |
| 7503 | /* Put the next network event into the db */ |
| 7504 | void wallet_save_network_event(struct lightningd *ld, |
| 7505 | const struct node_id *peer_id, |
| 7506 | enum network_event etype, |
| 7507 | const char *reason, |
| 7508 | u64 duration_nsec, |
| 7509 | bool connect_attempted) |
| 7510 | { |
| 7511 | u64 id; |
| 7512 | struct db_stmt *stmt; |
| 7513 | |
| 7514 | stmt = db_prepare_v2(ld->wallet->db, |
| 7515 | SQL("INSERT INTO network_events (" |
| 7516 | " id," |
| 7517 | " peer_id," |
| 7518 | " type, " |
| 7519 | " timestamp," |
| 7520 | " reason," |
| 7521 | " duration_nsec," |
| 7522 | " connect_attempted) VALUES " |
| 7523 | "(?, ?, ?, ?, ?, ?, ?);")); |
| 7524 | id = network_event_index_created(ld, etype, peer_id); |
| 7525 | db_bind_u64(stmt, id); |
| 7526 | db_bind_node_id(stmt, peer_id); |
| 7527 | db_bind_int(stmt, network_event_in_db(etype)); |
| 7528 | db_bind_u64(stmt, clock_time().ts.tv_sec); |
| 7529 | if (reason) |
| 7530 | db_bind_text(stmt, reason); |
| 7531 | else |
| 7532 | db_bind_null(stmt); |
| 7533 | db_bind_u64(stmt, duration_nsec); |
| 7534 | db_bind_int(stmt, connect_attempted); |
| 7535 | db_exec_prepared_v2(take(stmt)); |
| 7536 | } |
| 7537 | |
| 7538 | bool wallet_network_event_delete(struct wallet *w, u64 created_index) |
| 7539 | { |
nothing calls this directly
no test coverage detected