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.
This commit is contained in:
Christian Decker
2017-06-13 17:08:41 +02:00
committed by Rusty Russell
parent e80ef7dc19
commit 954b2c4a67

View File

@@ -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,