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

Function psbt_make_key

bitcoin/psbt.c:694–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692#define LIGHTNING_PROPRIETARY_PREFIX "lightning"
693
694u8 *psbt_make_key(const tal_t *ctx, u8 key_subtype, const u8 *key_data)
695{
696 /**
697 * BIP174:
698 * Type: Proprietary Use Type <tt>PSBT_GLOBAL_PROPRIETARY = 0xFC</tt>
699 ** Key: Variable length identifier prefix, followed
700 * by a subtype, followed by the key data itself.
701 *** <tt>{0xFC}|<prefix>|{subtype}|{key data}</tt>
702 ** Value: Any value data as defined by the proprietary type user.
703 *** <tt><data></tt>
704 */
705 u8 *key = tal_arr(ctx, u8, 0);
706 add_type(&key, WALLY_PSBT_PROPRIETARY_TYPE);
707 add_varint(&key, strlen(LIGHTNING_PROPRIETARY_PREFIX));
708 add(&key, LIGHTNING_PROPRIETARY_PREFIX,
709 strlen(LIGHTNING_PROPRIETARY_PREFIX));
710 add_type(&key, key_subtype);
711 if (key_data)
712 add(&key, key_data, tal_bytelen(key_data));
713 return key;
714}
715
716static void map_replace(const tal_t *ctx,
717 struct wally_map *map,

Callers 7

psbt_get_lightningFunction · 0.85
psbt_set_lightningFunction · 0.85
psbt_input_set_serial_idFunction · 0.85
psbt_input_mark_oursFunction · 0.85
mainFunction · 0.85

Calls 4

add_typeFunction · 0.85
add_varintFunction · 0.85
tal_bytelenFunction · 0.85
addFunction · 0.70

Tested by 1

mainFunction · 0.68