diff --git a/src/libckpool.c b/src/libckpool.c index a77c8658..2d034d71 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -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) { diff --git a/src/libckpool.h b/src/libckpool.h index 8fc637b0..6f07652c 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -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);