| 1180 | } |
| 1181 | |
| 1182 | static bool extract_node_id(int gosstore_fd, size_t off, u16 type, |
| 1183 | struct node_id *id) |
| 1184 | { |
| 1185 | /* BOLT #7: |
| 1186 | * 1. type: 257 (`node_announcement`) |
| 1187 | * 2. data: |
| 1188 | * * [`signature`:`signature`] |
| 1189 | * * [`u16`:`flen`] |
| 1190 | * * [`flen*byte`:`features`] |
| 1191 | * * [`u32`:`timestamp`] |
| 1192 | * * [`point`:`node_id`] |
| 1193 | */ |
| 1194 | const size_t feature_len_off = 2 + 64; |
| 1195 | be16 flen; |
| 1196 | size_t node_id_off; |
| 1197 | |
| 1198 | off += sizeof(struct gossip_hdr); |
| 1199 | |
| 1200 | if (pread(gosstore_fd, &flen, sizeof(flen), off + feature_len_off) |
| 1201 | != sizeof(flen)) |
| 1202 | return false; |
| 1203 | |
| 1204 | node_id_off = off + feature_len_off + 2 + be16_to_cpu(flen) + 4; |
| 1205 | if (pread(gosstore_fd, id, sizeof(*id), node_id_off) != sizeof(*id)) |
| 1206 | return false; |
| 1207 | |
| 1208 | return true; |
| 1209 | } |
| 1210 | |
| 1211 | static struct command_result *nodes_refresh(struct command *cmd, |
| 1212 | struct table_desc *td, |
no test coverage detected