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

Function extract_revocation_basepoint

connectd/multiplex.c:1012–1089  ·  view source on GitHub ↗

Only works for open_channel2 and accept_channel2 */

Source from the content-addressed store, hash-verified

1010
1011/* Only works for open_channel2 and accept_channel2 */
1012static struct pubkey *extract_revocation_basepoint(const tal_t *ctx,
1013 const u8 *msg)
1014{
1015 const u8 *cursor = msg;
1016 size_t max = tal_bytelen(msg);
1017 enum peer_wire t;
1018 struct pubkey pubkey;
1019
1020 t = fromwire_u16(&cursor, &max);
1021
1022 switch (t) {
1023 case WIRE_OPEN_CHANNEL2:
1024 /* BOLT #2:
1025 * 1. type: 64 (`open_channel2`)
1026 * 2. data:
1027 * * [`chain_hash`:`chain_hash`]
1028 * * [`channel_id`:`temporary_channel_id`]
1029 * * [`u32`:`funding_feerate_perkw`]
1030 * * [`u32`:`commitment_feerate_perkw`]
1031 * * [`u64`:`funding_satoshis`]
1032 * * [`u64`:`dust_limit_satoshis`]
1033 * * [`u64`:`max_htlc_value_in_flight_msat`]
1034 * * [`u64`:`htlc_minimum_msat`]
1035 * * [`u16`:`to_self_delay`]
1036 * * [`u16`:`max_accepted_htlcs`]
1037 * * [`u32`:`locktime`]
1038 * * [`point`:`funding_pubkey`]
1039 * * [`point`:`revocation_basepoint`]
1040 */
1041 fromwire_pad(&cursor, &max,
1042 sizeof(struct bitcoin_blkid)
1043 + sizeof(struct channel_id)
1044 + sizeof(u32)
1045 + sizeof(u32)
1046 + sizeof(u64)
1047 + sizeof(u64)
1048 + sizeof(u64)
1049 + sizeof(u64)
1050 + sizeof(u16)
1051 + sizeof(u16)
1052 + sizeof(u32)
1053 + PUBKEY_CMPR_LEN);
1054 break;
1055 case WIRE_ACCEPT_CHANNEL2:
1056 /* BOLT #2:
1057 * 1. type: 65 (`accept_channel2`)
1058 * 2. data:
1059 * * [`channel_id`:`temporary_channel_id`]
1060 * * [`u64`:`funding_satoshis`]
1061 * * [`u64`:`dust_limit_satoshis`]
1062 * * [`u64`:`max_htlc_value_in_flight_msat`]
1063 * * [`u64`:`htlc_minimum_msat`]
1064 * * [`u32`:`minimum_depth`]
1065 * * [`u16`:`to_self_delay`]
1066 * * [`u16`:`max_accepted_htlcs`]
1067 * * [`point`:`funding_pubkey`]
1068 * * [`point`:`revocation_basepoint`]
1069 */

Callers 2

update_v2_channelidFunction · 0.85
maybe_update_channelidFunction · 0.85

Calls 5

tal_bytelenFunction · 0.85
abortFunction · 0.85
fromwire_pubkeyFunction · 0.85
fromwire_u16Function · 0.50
fromwire_padFunction · 0.50

Tested by

no test coverage detected