* Create threadpool for reverseDns (rather than use new Thread() repeatedly)
* For getAddr() run completion handler on callback thread (and eliminate new Thread())
* Add getHostName() method that handles case where peerAddress.getAddr() is null
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.
By using a CoinSelector that selects exactly the outputs that have been sent to us,
we make sure that
* we exactly send the value that has been sent to us, minus fee
* if the incoming transaction became invalid (e.g. due to a re-org),
our outgoing transaction would become invalid, too
Strictly speaking, after this change we would not need to wait for confirmations any
more.
This will speed up synchronization because the .setMaxConnections() call
will occur before synchronization is finished and the necessary number of Peers
will be found sooner.
Also IMO this a better example because most apps should not block while syncing the chain.
This means for mainnet and testnet, you don't have to provide the network name.
It will be inferred from the address. For signet and regtest however the network
name is still needed.
* Use `CompletableFuture` for all asynchronous operations
* Use `thenCompose` to chain them
* sendTransaction takes a SendRequest and returns a TransactionBroadcast
* The main "CoinsReceived" listener method uses one .thenCompose() for
completing/signing/preparing-to-broadcast the transaction and another for waiting
for it to be confirmed by peers.
Use network.toString(). This also adds support for SIGNET. It changes the
filename for MAINNET, but as this is just an example I don't think we really
need to preserve backward-compatibility for the filename.
* WalletAppKit: add a constructor that takes a BitcoinNetwork
* WalletAppKit: deprecate constructors taking netParams or Context
* WalletAppKit: add an accessor for network()
* Update examples, tools, and wallettemplate to use the new constructor
This also moves Coin, Fiat, its parent Monetary and the related MonetaryFormat into the new base package.
See the provided package-info.java for details.