| 1537 | } |
| 1538 | |
| 1539 | u8 *handle_channel_update(struct routing_state *rstate, const u8 *update TAKES, |
| 1540 | struct peer *peer, |
| 1541 | struct short_channel_id *unknown_scid, |
| 1542 | bool force) |
| 1543 | { |
| 1544 | u8 *serialized; |
| 1545 | const struct node_id *owner; |
| 1546 | secp256k1_ecdsa_signature signature; |
| 1547 | struct short_channel_id short_channel_id; |
| 1548 | u32 timestamp; |
| 1549 | u8 message_flags, channel_flags; |
| 1550 | u16 expiry; |
| 1551 | struct amount_msat htlc_minimum, htlc_maximum; |
| 1552 | u32 fee_base_msat; |
| 1553 | u32 fee_proportional_millionths; |
| 1554 | struct bitcoin_blkid chain_hash; |
| 1555 | u8 direction; |
| 1556 | struct pending_cannouncement *pending; |
| 1557 | u8 *warn; |
| 1558 | |
| 1559 | serialized = tal_dup_talarr(tmpctx, u8, update); |
| 1560 | if (!fromwire_channel_update(serialized, &signature, |
| 1561 | &chain_hash, &short_channel_id, |
| 1562 | ×tamp, &message_flags, |
| 1563 | &channel_flags, &expiry, |
| 1564 | &htlc_minimum, &fee_base_msat, |
| 1565 | &fee_proportional_millionths, |
| 1566 | &htlc_maximum)) { |
| 1567 | warn = towire_warningfmt(rstate, NULL, |
| 1568 | "Malformed channel_update %s", |
| 1569 | tal_hex(tmpctx, serialized)); |
| 1570 | return warn; |
| 1571 | } |
| 1572 | direction = channel_flags & 0x1; |
| 1573 | |
| 1574 | /* BOLT #7: |
| 1575 | * |
| 1576 | * The receiving node: |
| 1577 | *... |
| 1578 | * - if the specified `chain_hash` value is unknown (meaning it isn't |
| 1579 | * active on the specified chain): |
| 1580 | * - MUST ignore the channel update. |
| 1581 | */ |
| 1582 | if (!bitcoin_blkid_eq(&chain_hash, &chainparams->genesis_blockhash)) { |
| 1583 | status_peer_debug(peer ? &peer->id : NULL, |
| 1584 | "Received channel_update for unknown chain %s", |
| 1585 | type_to_string(tmpctx, struct bitcoin_blkid, |
| 1586 | &chain_hash)); |
| 1587 | return NULL; |
| 1588 | } |
| 1589 | |
| 1590 | /* If we dropped the matching announcement for this channel due to the |
| 1591 | * txout query failing, don't report failure, it's just too noisy on |
| 1592 | * mainnet */ |
| 1593 | if (in_txout_failures(rstate, &short_channel_id)) |
| 1594 | return NULL; |
| 1595 | |
| 1596 | /* If we have an unvalidated channel, just queue on that */ |
no test coverage detected