Browse Source

Fix parsing of txout value. Force decimal base.

ppa-0.6.1
Björge Dijkstra 7 years ago
committed by Christian Decker
parent
commit
82a2d2f0a6
  1. 4
      common/json.c

4
common/json.c

@ -95,14 +95,14 @@ bool json_tok_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
char *end;
unsigned long btc, sat;
btc = strtoul(buffer + tok->start, &end, 0);
btc = strtoul(buffer + tok->start, &end, 10);
if (btc == ULONG_MAX && errno == ERANGE)
return false;
if (end != buffer + tok->end) {
/* Expect always 8 decimal places. */
if (*end != '.' || buffer + tok->end - end != 9)
return false;
sat = strtoul(end+1, &end, 0);
sat = strtoul(end+1, &end, 10);
if (sat == ULONG_MAX && errno == ERANGE)
return false;
if (end != buffer + tok->end)

Loading…
Cancel
Save