psbt: Add ability to set global PSBT values

Changelog-None
This commit is contained in:
Dusty Daemon 2024-11-11 11:00:43 +10:30 committed by Rusty Russell
parent fa0d9b6d2a
commit 66fe338290
2 changed files with 24 additions and 0 deletions

View File

@ -641,6 +641,17 @@ void *psbt_get_lightning(const struct wally_map *map,
return item->value;
}
void psbt_set_lightning(const tal_t *ctx,
struct wally_map *map,
const u8 proprietary_type,
const void *value,
size_t val_len)
{
u8 *key = psbt_make_key(NULL, proprietary_type, NULL);
map_replace(ctx, map, key, value, val_len);
tal_free(key);
}
void psbt_output_set_unknown(const tal_t *ctx,
struct wally_psbt_output *out,
const u8 *key,

View File

@ -220,6 +220,19 @@ void *psbt_get_lightning(const struct wally_map *map,
const u8 proprietary_type,
size_t *val_len);
/* psbt_set_lightning - Set a propreitary lightning value on the given map
*
* @map - map of unknowns to set the value
* @proprietary_type - type no. to set
* @value - the value to be set
* @val_len - length of value
*/
void psbt_set_lightning(const tal_t *ctx,
struct wally_map *map,
const u8 proprietary_type,
const void *value,
size_t val_len);
/* psbt_output_set_unknown - Set the given Key-Value in the psbt's output keymap
*
* @ctx - tal context for allocations