| 141 | } |
| 142 | |
| 143 | static void set_reserve_absolute(struct state * state, const struct amount_sat dust_limit, struct amount_sat reserve_sat) |
| 144 | { |
| 145 | status_debug("Setting their reserve to %s", |
| 146 | fmt_amount_sat(tmpctx, reserve_sat)); |
| 147 | if (state->allowdustreserve) { |
| 148 | state->localconf.channel_reserve = reserve_sat; |
| 149 | } else { |
| 150 | /* BOLT #2: |
| 151 | * |
| 152 | * The sender: |
| 153 | * ... |
| 154 | * - MUST set `channel_reserve_satoshis` greater than or equal |
| 155 | * to `dust_limit_satoshis` from the `open_channel` message. |
| 156 | */ |
| 157 | if (amount_sat_greater(dust_limit, reserve_sat)) { |
| 158 | status_debug("Their reserve is too small, bumping to " |
| 159 | "dust_limit: %s < %s", |
| 160 | fmt_amount_sat(tmpctx, reserve_sat), |
| 161 | fmt_amount_sat(tmpctx, dust_limit)); |
| 162 | state->localconf.channel_reserve = dust_limit; |
| 163 | } else { |
| 164 | state->localconf.channel_reserve = reserve_sat; |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /* We always set channel_reserve_satoshis to 1%, rounded down. */ |
| 170 | static void set_reserve(struct state *state, const struct amount_sat dust_limit) |
no test coverage detected