| 246 | } |
| 247 | |
| 248 | static struct local_update *add_update_channel(struct layer *layer, |
| 249 | const struct short_channel_id_dir *scidd, |
| 250 | const bool *enabled, |
| 251 | const struct amount_msat *htlc_min, |
| 252 | const struct amount_msat *htlc_max, |
| 253 | const struct amount_msat *base_fee, |
| 254 | const u32 *proportional_fee, |
| 255 | const u16 *delay) |
| 256 | { |
| 257 | struct local_update *lu; |
| 258 | |
| 259 | lu = local_update_hash_get(layer->local_updates, scidd); |
| 260 | if (!lu) { |
| 261 | lu = tal(layer, struct local_update); |
| 262 | lu->scidd = *scidd; |
| 263 | lu->enabled = NULL; |
| 264 | lu->delay = NULL; |
| 265 | lu->proportional_fee = NULL; |
| 266 | lu->base_fee = lu->htlc_min = lu->htlc_max = NULL; |
| 267 | local_update_hash_add(layer->local_updates, lu); |
| 268 | } |
| 269 | if (enabled) { |
| 270 | tal_free(lu->enabled); |
| 271 | lu->enabled = tal_dup(lu, bool, enabled); |
| 272 | } |
| 273 | if (htlc_min) { |
| 274 | tal_free(lu->htlc_min); |
| 275 | lu->htlc_min = tal_dup(lu, struct amount_msat, htlc_min); |
| 276 | } |
| 277 | if (htlc_max) { |
| 278 | tal_free(lu->htlc_max); |
| 279 | lu->htlc_max = tal_dup(lu, struct amount_msat, htlc_max); |
| 280 | } |
| 281 | if (base_fee) { |
| 282 | tal_free(lu->base_fee); |
| 283 | lu->base_fee = tal_dup(lu, struct amount_msat, base_fee); |
| 284 | } |
| 285 | if (proportional_fee) { |
| 286 | tal_free(lu->proportional_fee); |
| 287 | lu->proportional_fee = tal_dup(lu, u32, proportional_fee); |
| 288 | } |
| 289 | if (delay) { |
| 290 | tal_free(lu->delay); |
| 291 | lu->delay = tal_dup(lu, u16, delay); |
| 292 | } |
| 293 | return lu; |
| 294 | } |
| 295 | |
| 296 | static const struct constraint *add_constraint(struct layer *layer, |
| 297 | const struct short_channel_id_dir *scidd, |
no test coverage detected