Is the given address a p2wsh address?
10734
def btc_is_p2wsh_address( address ):
    
    wver, whash = segwit_addr_decode(address)
    if whash is None:
        return False
    
    if len(whash) != 32:
        return False

    return True
838586
boolean isEligible(Address address, @Nullable List<Route> routes) {
    // If this connection is not accepting new exchanges, we're done.
    if (transmitters.size() >= allocationLimit || noNewExchanges) return false;

    // If the non-host fields of the address don't overlap, we're done.
    if (!Internal.instance.equalsNonHost(this.route.address(), address)) return false;

    // If the host exactly matches, we're done: this connection can carry the address.
    if (address.url().host().equals(this.route().address().url().host())) {
      return true; // This connection is a perfect match.
    }

    // At this point we don't have a hostname match. But we still be able to carry the request if
    // our connection coalescing requirements are met. See also:
    // https://hpbn.co/optimizing-application-delivery/#eliminate-domain-sharding
    // https://daniel.haxx.se/blog/2016/08/18/http2-connection-coalescing/

    // 1. This connection must be HTTP/2.
    if (http2Connection == null) return false;

    // 2. The routes must share an IP address.
    if (routes == null || !routeMatchesAny(routes)) return false;

    // 3. This connection's server certificate's must cover the new host.
    if (address.hostnameVerifier() != OkHostnameVerifier.INSTANCE) return false;
    if (!supportsUrl(address.url())) return false;

    // 4. Certificate pinning must match the host.
    try {
      address.certificatePinner().check(address.url().host(), handshake().peerCertificates());
    } catch (SSLPeerUnverifiedException e) {
      return false;
    }

    return true; // The caller's address can be carried by this connection.
  }
630486
def segwit_address(self):
        """"""
        # Only make segwit address if public key is compressed
        if self._segwit_address is None and self.is_compressed():
            self._segwit_address = public_key_to_segwit_address(
                self._public_key, version=self.version)
        return self._segwit_address
743241
def address(self, is_compressed=None):
        
        return self._network.address.for_p2pkh(self.hash160(is_compressed=is_compressed))
791157
public boolean isPermittedAddress(String addr) {
        if (addr == null || addr.isEmpty()) {
            return false;
        }

        for (DomainMatcher permAddr : permittedAddressesEnabled) {
            if (permAddr.matches(addr)) {
                return true;
            }
        }
        return false;
    }
346677
def p2sh_p2pkh_script(network: str, address: str) -> P2shScript:
    ''''''

    network_params = net_query(network)

    addr = Address.from_string(network=network_params,
                               string=address)

    p2pkh = P2pkhScript(addr)

    return P2shScript(p2pkh)
1184784
private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) {
        return checkMethod(networkInterface, isUp) &&
               checkMethod(networkInterface, supportsMulticast) &&
               // TODO: IpV6 support
               !(interfaceAddress instanceof Inet6Address) &&
               !interfaceAddress.isLoopbackAddress();
    }
693959
public static boolean isP2WH(Script script) {
        List<ScriptChunk> chunks = script.chunks;
        if (chunks.size() != 2)
            return false;
        if (!chunks.get(0).equalsOpCode(OP_0))
            return false;
        byte[] chunk1data = chunks.get(1).data;
        if (chunk1data == null)
            return false;
        if (chunk1data.length != SegwitAddress.WITNESS_PROGRAM_LENGTH_PKH
                && chunk1data.length != SegwitAddress.WITNESS_PROGRAM_LENGTH_SH)
            return false;
        return true;
    }
1076297
private static boolean isValidAddress(InetAddress address) {
        if (address == null || address.isLoopbackAddress()) {
            return false;
        }
        String name = address.getHostAddress();
        return (name != null
            && !isAnyHost(name)
            && !isLocalHost(name)
            && isIPv4Host(name));
    }
640983
private function p2c()
	{
		if($this->returnLocationData['postal_code'] && ! $this->returnLocationData['latitude']) {
            $this->method = 'GET';
			$this->updateResponseWithResults($this->gateway($this->createAddressUrl()));

			if($this->shouldRunC2A) {
				$this->c2a();
			}

			return true;
		}
	}
1023802
private boolean isAllowedAddress(String ipAddress) {
        if (allowedAddresses == null) {
            return false;
        }

        // IPv4
        int offset = ipAddress.lastIndexOf('.');
        if (offset == -1) {
            // IPv6
            offset = ipAddress.lastIndexOf(':');
            if (offset == -1) {
                return false;
            }
        }

        String ipAddressClass = ipAddress.substring(0, offset + 1) + '*';
        return (allowedAddresses.contains(ipAddressClass) || allowedAddresses.contains(ipAddress));
    }
859982
def is_ipaddress(hostname):
    
    if six.PY3 and isinstance(hostname, bytes):
        # IDN A-label bytes are ASCII compatible.
        hostname = hostname.decode('ascii')

    families = [socket.AF_INET]
    if hasattr(socket, 'AF_INET6'):
        families.append(socket.AF_INET6)

    for af in families:
        try:
            inet_pton(af, hostname)
        except (socket.error, ValueError, OSError):
            pass
        else:
            return True
    return False
303700
function readSharedAddressPeers(shared_address, handlePeers){
	db.query(
		"SELECT DISTINCT address, name FROM shared_address_signing_paths LEFT JOIN correspondent_devices USING(device_address) \n\
		WHERE shared_address=? AND shared_address_signing_paths.device_address!=?",
		[shared_address, device.getMyDeviceAddress()],
		function(rows){
			// no problem if no peers found: the peer can be part of our multisig address and his device address will be rewritten to ours
		//	if (rows.length === 0)
		//		throw Error("no peers found for shared address "+shared_address);
			var assocNamesByAddress = {};
			rows.forEach(function(row){
				assocNamesByAddress[row.address] = row.name || 'unknown peer';
			});
			handlePeers(assocNamesByAddress);
		}
	);
}
932442
def btc_is_p2sh_address( address ):
    
    vb = keylib.b58check.b58check_version_byte( address )
    if vb == multisig_version_byte:
        return True
    else:
        return False
666104
private boolean checkInetAddress(InetAddress inetAddress) {

        //  Check if not local host
        if (! inetAddress.getCanonicalHostName().startsWith("local")) {
            //  Check if name is not the address (???)
            if (!inetAddress.getCanonicalHostName().equalsIgnoreCase(inetAddress.getHostAddress())) {

                addresses.add(inetAddress.getHostAddress());

                //  Check if IPV 4 address
                if (isIPV4address(inetAddress.getHostAddress())) {
                    name = inetAddress.getCanonicalHostName();
                    address = inetAddress.getHostAddress();
                    //System.out.println(name+":	" + address);
                    return true;
                }
            } else if (trace)
                System.err.println(
                        "Warning: at least one getCanonicalHostName() returns " + inetAddress.getCanonicalHostName() +
                        "\n  Check files /etc/resolv.conf and /etc/nsswitch.conf ");
        }
        return false;
    }
189705
private void maybeMarkCurrentAddressAsUsed(LegacyAddress address) {
        checkArgument(address.getOutputScriptType() == ScriptType.P2SH);
        for (Map.Entry<KeyChain.KeyPurpose, Address> entry : currentAddresses.entrySet()) {
            if (entry.getValue() != null && entry.getValue().equals(address)) {
                log.info("Marking P2SH address as used: {}", address);
                currentAddresses.put(entry.getKey(), freshAddress(entry.getKey()));
                return;
            }
        }
    }
978169
def parse_hash(address):
    '''
    
    '''

    raw = parse(address)

    # Cash addresses
    try:
        if address.find(riemann.network.CASHADDR_PREFIX) == 0:
            if raw.find(riemann.network.CASHADDR_P2SH) == 0:
                return raw[len(riemann.network.CASHADDR_P2SH):]
            if raw.find(riemann.network.CASHADDR_P2PKH) == 0:
                return raw[len(riemann.network.CASHADDR_P2PKH):]
    except TypeError:
        pass

    # Segwit addresses
    try:
        if address.find(riemann.network.BECH32_HRP) == 0:
            if raw.find(riemann.network.P2WSH_PREFIX) == 0:
                return raw[len(riemann.network.P2WSH_PREFIX):]
            if raw.find(riemann.network.P2WPKH_PREFIX) == 0:
                return raw[len(riemann.network.P2WPKH_PREFIX):]
    except TypeError:
        pass

    # Legacy Addresses
    if raw.find(riemann.network.P2SH_PREFIX) == 0:
        return raw[len(riemann.network.P2SH_PREFIX):]
    if raw.find(riemann.network.P2PKH_PREFIX) == 0:
        return raw[len(riemann.network.P2PKH_PREFIX):]