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

Function set_reserve_absolute

openingd/openingd.c:143–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static 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. */
170static 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
fmt_amount_satFunction · 0.50

Tested by

no test coverage detected