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

Function handle_splice_feerate_error

lightningd/channel_control.c:282–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282static void handle_splice_feerate_error(struct lightningd *ld,
283 struct channel *channel,
284 const u8 *msg)
285{
286 struct splice_command *cc;
287 struct amount_msat fee;
288 bool too_high;
289 char *error_msg;
290
291 if (!fromwire_channeld_splice_feerate_error(msg, &fee, &too_high)) {
292 channel_internal_error(channel,
293 "bad fromwire_channeld_splice_feerate_error %s",
294 tal_hex(channel, msg));
295 return;
296 }
297
298 cc = splice_command_for_chan(ld, channel);
299 if (cc) {
300 if (too_high)
301 error_msg = tal_fmt(tmpctx, "Feerate too high. Do you "
302 "really want to spend %s on fees?",
303 fmt_amount_msat(tmpctx, fee));
304 else
305 error_msg = tal_fmt(tmpctx, "Feerate too low. Your "
306 "funding only provided %s in fees",
307 fmt_amount_msat(tmpctx, fee));
308
309 was_pending(command_fail(cc->cmd,
310 too_high ? SPLICE_HIGH_FEE : SPLICE_LOW_FEE,
311 "%s", error_msg));
312 }
313 else {
314 log_peer_unusual(ld->log, &channel->peer->id, "Peer gave us a"
315 " splice pkg with too low of feerate (fee was"
316 " %s), we rejected it.",
317 fmt_amount_msat(tmpctx, fee));
318 }
319}
320
321static void handle_splice_abort(struct lightningd *ld,
322 struct channel *channel,

Callers 1

channel_msgFunction · 0.85

Calls 6

tal_hexFunction · 0.85
splice_command_for_chanFunction · 0.85
channel_internal_errorFunction · 0.70
was_pendingFunction · 0.70
command_failFunction · 0.70
fmt_amount_msatFunction · 0.50

Tested by

no test coverage detected