mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
Address: add network() helper to allow migrating away from using NetworkParameters
This commit is contained in:
parent
1d5e752917
commit
26117bbda8
1 changed files with 10 additions and 0 deletions
|
@ -18,6 +18,7 @@ package org.bitcoinj.core;
|
||||||
|
|
||||||
import org.bitcoinj.base.ScriptType;
|
import org.bitcoinj.base.ScriptType;
|
||||||
import org.bitcoinj.base.exceptions.AddressFormatException;
|
import org.bitcoinj.base.exceptions.AddressFormatException;
|
||||||
|
import org.bitcoinj.utils.Network;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -148,6 +149,15 @@ public abstract class Address implements Comparable<Address> {
|
||||||
@Override
|
@Override
|
||||||
abstract public int compareTo(Address o);
|
abstract public int compareTo(Address o);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the network this address works on. Use of {@link Network} is preferred to use of {@link NetworkParameters}
|
||||||
|
* when you need to know what network an address is for.
|
||||||
|
* @return the Network.
|
||||||
|
*/
|
||||||
|
public Network network() {
|
||||||
|
return params.network();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comparator for the first two comparison fields in {@code Address} comparisons, see {@link Address#compareTo(Address)}.
|
* Comparator for the first two comparison fields in {@code Address} comparisons, see {@link Address#compareTo(Address)}.
|
||||||
* Used by {@link LegacyAddress#compareTo(Address)} and {@link SegwitAddress#compareTo(Address)}.
|
* Used by {@link LegacyAddress#compareTo(Address)} and {@link SegwitAddress#compareTo(Address)}.
|
||||||
|
|
Loading…
Add table
Reference in a new issue