varint: make helper public

This commit is contained in:
niftynei 2023-07-07 00:33:01 -05:00 committed by Rusty Russell
parent aba4d18ed1
commit 388f27edce
2 changed files with 8 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#include <bitcoin/psbt.h>
#include <bitcoin/pubkey.h>
#include <bitcoin/script.h>
#include <bitcoin/varint.h>
#include <ccan/ccan/array_size/array_size.h>
#include <ccan/ccan/mem/mem.h>
#include <ccan/tal/str/str.h>
@ -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"

View File

@ -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
*