| 182 | } |
| 183 | |
| 184 | static struct short_channel_id_dir add_connection(int store_fd, char from, char to, |
| 185 | u32 base_fee, |
| 186 | s32 proportional_fee, |
| 187 | u32 delay, |
| 188 | struct amount_sat capacity) |
| 189 | { |
| 190 | secp256k1_ecdsa_signature dummy_sig; |
| 191 | struct secret not_a_secret; |
| 192 | struct pubkey dummy_key; |
| 193 | u8 *msg; |
| 194 | struct node_id from_id, to_id; |
| 195 | const struct node_id *ids[2]; |
| 196 | static struct short_channel_id_dir scidd; |
| 197 | |
| 198 | /* So valgrind doesn't complain */ |
| 199 | memset(&dummy_sig, 0, sizeof(dummy_sig)); |
| 200 | memset(¬_a_secret, 1, sizeof(not_a_secret)); |
| 201 | pubkey_from_secret(¬_a_secret, &dummy_key); |
| 202 | |
| 203 | node_id(from, &from_id); |
| 204 | node_id(to, &to_id); |
| 205 | |
| 206 | if (node_id_cmp(&from_id, &to_id) > 0) { |
| 207 | scidd.dir = 1; |
| 208 | ids[0] = &to_id; |
| 209 | ids[1] = &from_id; |
| 210 | } else { |
| 211 | scidd.dir = 0; |
| 212 | ids[0] = &from_id; |
| 213 | ids[1] = &to_id; |
| 214 | } |
| 215 | scidd.scid.u64++; |
| 216 | msg = towire_channel_announcement(tmpctx, &dummy_sig, &dummy_sig, |
| 217 | &dummy_sig, &dummy_sig, |
| 218 | /* features */ NULL, |
| 219 | &chainparams->genesis_blockhash, |
| 220 | scidd.scid, |
| 221 | ids[0], ids[1], |
| 222 | &dummy_key, &dummy_key); |
| 223 | write_to_store(store_fd, msg); |
| 224 | msg = towire_gossip_store_channel_amount(tmpctx, capacity); |
| 225 | write_to_store(store_fd, msg); |
| 226 | |
| 227 | update_connection(store_fd, &from_id, &to_id, scidd.scid, |
| 228 | AMOUNT_MSAT(0), |
| 229 | amount_msat(capacity.satoshis * 1000), |
| 230 | base_fee, proportional_fee, |
| 231 | delay, false); |
| 232 | return scidd; |
| 233 | } |
| 234 | |
| 235 | /* A -> B -> C -> D -> E |
| 236 | * |
no test coverage detected