* Include `hostname` in equals() and hashcode()
* Fix NPE in toString() that occurs for (unsupported) I2P addresses (both addr and hostname are null)
* Better null-handling in equals()
* Add EqualsVerify test
* Add comments
Normalize/canonicalize network member of Address types.
LegacyAddress: map SIGNET, REGTEST to TESTNET
SegwitAddress: map SIGNET to TESTNET
Add tests to verify correct behavoir.
All of them are unmaintained and their tests are in the way of refactorings.
MySQL and Postgres had been disabled for a while, and one seems to care.
H2 is tested, but pulls a driver dependency into the test classpath.
LegacyAddress, SegwitAddress: replace static factories that take NetworkParameters
* Add static factory methods that take `Network`
* Deprecate static factory methods that take `NetworkParameters`
* Add `Networks` support to `NetworkParameters.of(Network)`
* Update all usages to use the new methods
Distinguish between `Network` and `BitcoinNetwork` in the code
(some of our implementation supports alt-networks better than others
and this commit doesn't try to fix them all, just make it more clear
what is going on. Some may never be made 'generic')
This change migrates from using `NetworkParameters` to `Network` for specifying the network and
also decouples from static methods in `Address` with an interface/implementation approach.
Note that there are 3 use cases for address parsing:
1. Any network is allowed - AddressParser.parseAddressAnyNetwork(String)
2. Parse for a specified network - AddressParser.parseAddress(String, Network)
3. Parse for a previously-specified (context dependent) network - AddressParser.Strict.parseAddress(String)
In most use cases, an AddressParser instance can be accessed through the Wallet,
which already knows the Network type and in this context validation for network makes
sense. This is why `Wallet` is implementing `AddressParser.Strict`
BitcoinURI allocates its own DefaultAddressParser for now, as do some other tests
and examples that don't have access to a Wallet
In the future DefaultAddressParser may be replaced by something loaded
via the ServiceLoader mechanism or other dynamically configured mechanism.
* Add `of(BitcoinNetwork)` `static` method in `AbstractBitcoinNetParams`
* In `NetworkParameters.of(Network)` delegate to `AbstractBitcoinNetParams` for type `BitcoinNetwork`
Perhaps in the future, we'll want a `network` private or protected member,
but for now that doesn't seem needed.
When we start using Network for address and transaction creation, this
will be used even more.