Provide a way to extract a serialised integer
This commit is contained in:
parent
f07fb994ed
commit
4f60dc1b8a
@ -1255,6 +1255,18 @@ int ser_number(uchar *s, int32_t val)
|
||||
return len;
|
||||
}
|
||||
|
||||
int get_sernumber(uchar *s)
|
||||
{
|
||||
int32_t val = 0;
|
||||
int len;
|
||||
|
||||
len = s[0];
|
||||
if (unlikely(len < 1 || len > 4))
|
||||
return 0;
|
||||
memcpy(&val, &s[1], len);
|
||||
return le32toh(val);
|
||||
}
|
||||
|
||||
/* For testing a le encoded 256 byte hash against a target */
|
||||
bool fulltest(const uchar *hash, const uchar *target)
|
||||
{
|
||||
|
||||
@ -344,6 +344,7 @@ void b58tobin(char *b58bin, const char *b58);
|
||||
|
||||
void address_to_pubkeytxn(char *pkh, const char *addr);
|
||||
int ser_number(uchar *s, int32_t val);
|
||||
int get_sernumber(uchar *s);
|
||||
bool fulltest(const uchar *hash, const uchar *target);
|
||||
|
||||
void copy_tv(tv_t *dest, const tv_t *src);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user