diff --git a/bitcoin/psbt.c b/bitcoin/psbt.c index 2ad2bb880..fe9510b25 100644 --- a/bitcoin/psbt.c +++ b/bitcoin/psbt.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -467,12 +468,12 @@ static void add_type(u8 **key, const u8 num) add(key, &num, 1); } -static void add_varint(u8 **key, size_t val) +void add_varint(u8 **arr, size_t val) { u8 vt[VARINT_MAX_LEN]; size_t vtlen; vtlen = varint_put(vt, val); - add(key, vt, vtlen); + tal_expand(arr, vt, vtlen); } #define LIGHTNING_PROPRIETARY_PREFIX "lightning" diff --git a/bitcoin/psbt.h b/bitcoin/psbt.h index 0788b40aa..309dd9517 100644 --- a/bitcoin/psbt.h +++ b/bitcoin/psbt.h @@ -17,6 +17,11 @@ struct bitcoin_signature; struct bitcoin_txid; struct pubkey; + +/* Utility we need for psbt stuffs; + * add the varint onto the given array */ +void add_varint(u8 **arr, size_t val); + /** * create_psbt - Create a new psbt object *