Browse Source

fix: Corrently parse non-testnet p2pkh addresses

The return value of `b58check` is negative on failure, and positive
values are the address version, i.e., 0 in the case of mainnet
addresses.
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
954b2c4a67
  1. 2
      bitcoin/base58.c

2
bitcoin/base58.c

@ -61,7 +61,7 @@ static bool from_base58(u8 *version,
int r = b58check(buf, sizeof(buf), base58, base58_len);
*version = buf[0];
memcpy(rmd, buf + 1, sizeof(*rmd));
return r > 0;
return r >= 0;
}
bool bitcoin_from_base58(bool *test_net,

Loading…
Cancel
Save