Get the announcement msg which created this chan */
| 1122 | |
| 1123 | /* Get the announcement msg which created this chan */ |
| 1124 | u8 *gossmap_chan_get_announce(const tal_t *ctx, |
| 1125 | const struct gossmap *map, |
| 1126 | const struct gossmap_chan *c) |
| 1127 | { |
| 1128 | u32 len; |
| 1129 | u8 *msg; |
| 1130 | u32 pre_off; |
| 1131 | |
| 1132 | /* We need to go back to struct gossip_hdr to get len */ |
| 1133 | if (c->private) |
| 1134 | pre_off = 2 + 8 + 2 + sizeof(struct gossip_hdr); |
| 1135 | else |
| 1136 | pre_off = sizeof(struct gossip_hdr); |
| 1137 | len = (map_be32(map, c->cann_off - pre_off) & GOSSIP_STORE_LEN_MASK); |
| 1138 | |
| 1139 | msg = tal_arr(ctx, u8, len); |
| 1140 | map_copy(map, c->cann_off, msg, len); |
| 1141 | return msg; |
| 1142 | } |
| 1143 | |
| 1144 | /* Get the announcement msg (if any) for this node. */ |
| 1145 | u8 *gossmap_node_get_announce(const tal_t *ctx, |