| 692 | #define LIGHTNING_PROPRIETARY_PREFIX "lightning" |
| 693 | |
| 694 | u8 *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 | |
| 716 | static void map_replace(const tal_t *ctx, |
| 717 | struct wally_map *map, |