wire: add var_int parsing functions

so we can put and pull bitcoin 'var_int' length types from the
wire.

for more info on variable integers, see http://learnmeabitcoin.com/glossary/varint
This commit is contained in:
lisa neigut
2019-04-02 17:18:06 -07:00
committed by Rusty Russell
parent 1213f44071
commit 74ae9f09ac
3 changed files with 39 additions and 0 deletions

View File

@@ -67,6 +67,7 @@ void towire_u64(u8 **pptr, u64 v);
void towire_double(u8 **pptr, const double *v);
void towire_pad(u8 **pptr, size_t num);
void towire_bool(u8 **pptr, bool v);
void towire_var_int(u8 **pptr, const u64 val);
void towire_u8_array(u8 **pptr, const u8 *arr, size_t num);
@@ -83,6 +84,7 @@ u32 fromwire_u32(const u8 **cursor, size_t *max);
u64 fromwire_u64(const u8 **cursor, size_t *max);
void fromwire_double(const u8 **cursor, size_t *max, double *v);
bool fromwire_bool(const u8 **cursor, size_t *max);
u64 fromwire_var_int(const u8 **cursor, size_t *max);
void fromwire_secret(const u8 **cursor, size_t *max, struct secret *secret);
void fromwire_privkey(const u8 **cursor, size_t *max, struct privkey *privkey);
void fromwire_pubkey(const u8 **cursor, size_t *max, struct pubkey *pubkey);