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

Function handle_feerates

channeld/channeld.c:3418–3452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3416}
3417
3418static void handle_feerates(struct peer *peer, const u8 *inmsg)
3419{
3420 u32 feerate;
3421
3422 if (!fromwire_channeld_feerates(inmsg, &feerate,
3423 &peer->feerate_min,
3424 &peer->feerate_max,
3425 &peer->feerate_penalty))
3426 master_badmsg(WIRE_CHANNELD_FEERATES, inmsg);
3427
3428 /* BOLT #2:
3429 *
3430 * The node _responsible_ for paying the Bitcoin fee:
3431 * - SHOULD send `update_fee` to ensure the current fee rate is
3432 * sufficient (by a significant margin) for timely processing of the
3433 * commitment transaction.
3434 */
3435 if (peer->channel->opener == LOCAL) {
3436 peer->desired_feerate = feerate;
3437 /* Don't do this for the first feerate, wait until something else
3438 * happens. LND seems to get upset in some cases otherwise:
3439 * see https://github.com/ElementsProject/lightning/issues/3596 */
3440 if (peer->next_index[LOCAL] != 1
3441 || peer->next_index[REMOTE] != 1)
3442 start_commit_timer(peer);
3443 } else {
3444 /* BOLT #2:
3445 *
3446 * The node _not responsible_ for paying the Bitcoin fee:
3447 * - MUST NOT send `update_fee`.
3448 */
3449 /* FIXME: We could drop to chain if fees are too low, but
3450 * that's fraught too. */
3451 }
3452}
3453
3454static void handle_blockheight(struct peer *peer, const u8 *inmsg)
3455{

Callers 1

req_inFunction · 0.85

Calls 2

start_commit_timerFunction · 0.85
master_badmsgFunction · 0.50

Tested by

no test coverage detected