|
|
@ -96,26 +96,13 @@ bool json_to_txid(const char *buffer, const jsmntok_t *tok, |
|
|
|
bool json_to_outpoint(const char *buffer, const jsmntok_t *tok, |
|
|
|
struct bitcoin_outpoint *op) |
|
|
|
{ |
|
|
|
size_t len = tok->end - tok->start; |
|
|
|
char str[len + 1]; |
|
|
|
jsmntok_t t1, t2; |
|
|
|
|
|
|
|
if (len < 66) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
memcpy(str, buffer+tok->start, len); |
|
|
|
str[len] = 0x00; |
|
|
|
|
|
|
|
if (str[64] != ':') |
|
|
|
return NULL; |
|
|
|
|
|
|
|
if (!bitcoin_txid_from_hex(str, 64, &op->txid)) |
|
|
|
if (!split_tok(buffer, tok, ':', &t1, &t2)) |
|
|
|
return false; |
|
|
|
|
|
|
|
op->n = atoi(str + 65); |
|
|
|
if (op->n < 0) |
|
|
|
return false; |
|
|
|
|
|
|
|
return true; |
|
|
|
return json_to_txid(buffer, &t1, &op->txid) |
|
|
|
&& json_to_u32(buffer, &t2, &op->n); |
|
|
|
} |
|
|
|
|
|
|
|
bool json_to_channel_id(const char *buffer, const jsmntok_t *tok, |
|
|
|