MCPcopy Create free account
hub / github.com/ElementsProject/lightning / set_reserve_absolute

Function set_reserve_absolute

openingd/openingd.c:145–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

set_reserveFunction · 0.85
funder_channel_startFunction · 0.85
fundee_channelFunction · 0.85

Calls 2

amount_sat_greaterFunction · 0.85
type_to_stringClass · 0.50

Tested by

no test coverage detected