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

Function create_unsigned_update

gossipd/gossip_generation.c:508–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508static u8 *create_unsigned_update(const tal_t *ctx,
509 const struct short_channel_id *scid,
510 int direction,
511 bool disable,
512 u16 cltv_expiry_delta,
513 struct amount_msat htlc_minimum,
514 struct amount_msat htlc_maximum,
515 u32 fee_base_msat,
516 u32 fee_proportional_millionths,
517 bool public)
518{
519 secp256k1_ecdsa_signature dummy_sig;
520 u8 message_flags, channel_flags;
521
522 /* So valgrind doesn't complain */
523 memset(&dummy_sig, 0, sizeof(dummy_sig));
524
525 /* BOLT #7:
526 *
527 * The `channel_flags` bitfield is used to indicate the direction of
528 * the channel: it identifies the node that this update originated
529 * from and signals various options concerning the channel. The
530 * following table specifies the meaning of its individual bits:
531 *
532 * | Bit Position | Name | Meaning |
533 * | ------------- | ----------- | -------------------------------- |
534 * | 0 | `direction` | Direction this update refers to. |
535 * | 1 | `disable` | Disable the channel. |
536 */
537 channel_flags = direction;
538 if (disable)
539 channel_flags |= ROUTING_FLAGS_DISABLED;
540
541 /* BOLT #7:
542 *
543 * The `message_flags` bitfield is used to provide additional
544 * details about the message:
545 *
546 * | Bit Position | Name |
547 * | ------------- | ---------------|
548 * | 0 | `must_be_one` |
549 * | 1 | `dont_forward` |
550 */
551 message_flags = ROUTING_OPT_HTLC_MAX_MSAT;
552 if (!public)
553 message_flags |= ROUTING_OPT_DONT_FORWARD;
554
555 /* We create an update with a dummy signature and timestamp. */
556 return towire_channel_update(ctx,
557 &dummy_sig, /* sig set later */
558 &chainparams->genesis_blockhash,
559 scid,
560 0, /* timestamp set later */
561 message_flags, channel_flags,
562 cltv_expiry_delta,
563 htlc_minimum,
564 fee_base_msat,
565 fee_proportional_millionths,

Callers 2

refresh_local_channelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected