| 114 | } |
| 115 | |
| 116 | static bool add_htlc(struct channel *channel, enum side sender, u64 id, |
| 117 | const struct preimage *preimage, |
| 118 | struct amount_msat msatoshi, u32 cltv) |
| 119 | { |
| 120 | struct sha256 rhash; |
| 121 | u8 *dummy_routing; |
| 122 | |
| 123 | dummy_routing = tal_arr(channel, u8, TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE)); |
| 124 | sha256(&rhash, preimage, sizeof(*preimage)); |
| 125 | |
| 126 | if (channel_add_htlc(channel, sender, id, msatoshi, cltv, &rhash, |
| 127 | dummy_routing, NULL, NULL, NULL, NULL, true) != CHANNEL_ERR_ADD_OK) { |
| 128 | tal_free(dummy_routing); |
| 129 | return false; |
| 130 | } |
| 131 | |
| 132 | tal_free(dummy_routing); |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | static bool fulfill_htlc(struct channel *channel, enum side original_sender, |
| 137 | u64 id, const struct preimage *preimage) |
no test coverage detected