Java Code Examples for org.bitcoinj.core.NetworkParameters#getAcceptableAddressCodes()

The following examples show how to use org.bitcoinj.core.NetworkParameters#getAcceptableAddressCodes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfidentialAddress.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public ConfidentialAddress(final NetworkParameters params, final int version, final byte[] hash, final byte[] blindingPubKey)
        throws WrongNetworkException, WrongLengthException {
    super(4, getBytes(params, version, hash, blindingPubKey));
    checkNotNull(params);
    if (!isAcceptableVersion(params, version))
        throw new WrongNetworkException(version, params.getAcceptableAddressCodes());
    if (!isAcceptableLength(params, version, hash.length))
        throw new WrongLengthException(hash.length);
}
 
Example 2
Source File: ConfidentialAddress.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
protected ConfidentialAddress(final NetworkParameters params, final String address) throws AddressFormatException {
    super(address);

    checkNotNull(params);

    if (version != 4)
        throw new WrongNetworkException(version, params.getAcceptableAddressCodes());

    final byte[] hash = bytes;
    if (!isAcceptableLength(params, version, hash.length - 1 - 33)) // len - version - pubkey
        throw new WrongLengthException(hash.length);
}
 
Example 3
Source File: ConfidentialAddress.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public ConfidentialAddress(final NetworkParameters params, final int version, final byte[] hash, final byte[] blindingPubKey)
        throws WrongNetworkException, WrongLengthException {
    super(4, getBytes(params, version, hash, blindingPubKey));
    checkNotNull(params);
    if (!isAcceptableVersion(params, version))
        throw new WrongNetworkException(version, params.getAcceptableAddressCodes());
    if (!isAcceptableLength(params, version, hash.length))
        throw new WrongLengthException(hash.length);
}
 
Example 4
Source File: ConfidentialAddress.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
protected ConfidentialAddress(final NetworkParameters params, final String address) throws AddressFormatException {
    super(address);

    checkNotNull(params);

    if (version != 4)
        throw new WrongNetworkException(version, params.getAcceptableAddressCodes());

    final byte[] hash = bytes;
    if (!isAcceptableLength(params, version, hash.length - 1 - 33)) // len - version - pubkey
        throw new WrongLengthException(hash.length);
}
 
Example 5
Source File: ConfidentialAddress.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isAcceptableVersion(final NetworkParameters params, final int version) {
    for (final int v : params.getAcceptableAddressCodes())
        if (version == v)
            return true;
    return false;
}
 
Example 6
Source File: ConfidentialAddress.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isAcceptableVersion(final NetworkParameters params, final int version) {
    for (final int v : params.getAcceptableAddressCodes())
        if (version == v)
            return true;
    return false;
}