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

Function wally_map_set_unknown

bitcoin/psbt.c:509–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509static bool wally_map_set_unknown(const tal_t *ctx,
510 struct wally_map *map,
511 const u8 *key,
512 const void *value,
513 size_t value_len)
514{
515 size_t exists_at;
516 struct wally_map_item *item;
517
518 assert(value_len != 0);
519 if (wally_map_find(map, key, tal_bytelen(key), &exists_at) != WALLY_OK)
520 return false;
521
522 /* If not exists, add */
523 if (exists_at == 0) {
524 bool ok;
525 tal_wally_start();
526 ok = wally_map_add(map, key, tal_bytelen(key),
527 (unsigned char *) memcheck(value, value_len), value_len)
528 == WALLY_OK;
529 tal_wally_end(ctx);
530 return ok;
531 }
532
533 /* Already in map, update entry */
534 item = &map->items[exists_at - 1];
535 tal_resize(&item->value, value_len);
536 memcpy(item->value, memcheck(value, value_len), value_len);
537 item->value_len = value_len;
538
539 return true;
540}
541
542void psbt_input_set_unknown(const tal_t *ctx,
543 struct wally_psbt_input *in,

Callers 2

psbt_input_set_unknownFunction · 0.85
psbt_output_set_unknownFunction · 0.85

Calls 3

tal_bytelenFunction · 0.85
tal_wally_startFunction · 0.85
tal_wally_endFunction · 0.85

Tested by

no test coverage detected