Browse Source

Whitelist script addresses on testnet when wallet support is missing, and blacklist bech32 addresses.

master
Con Kolivas 7 years ago
parent
commit
cf476a8112
  1. 11
      src/bitcoin.c

11
src/bitcoin.c

@ -65,11 +65,16 @@ bool validate_address(connsock_t *cs, const char *address, bool *script, bool *s
ret = true;
tmp_val = json_object_get(res_val, "isscript");
if (unlikely(!tmp_val)) {
/* All recent bitcoinds should support this, if not, look for
* a 3x address to at least support it on mainnet */
/* All recent bitcoinds with wallet support built in should
* support this, if not, look for addresses the braindead way
* to tell if it's a script address. */
LOGDEBUG("No isscript support from bitcoind");
if (address[0] == '3')
if (address[0] == '3' || address[0] == '2')
*script = true;
/* Now look to see this isn't a bech32: We can't support
* bech32 without knowing if it's a pubkey or a script */
else if (address[0] != '1' && address[0] != 'm')
ret = false;
goto out;
}
*script = json_is_true(tmp_val);

Loading…
Cancel
Save