Commit graph

4009 commits

Author SHA1 Message Date
Andreas Schildbach
e5558986d4 LinuxSecureRandom: don't automatically install RNG workaround any more
LinuxSecureRandom used to be installed on Android because very old Android versions had a bug
in the random number generator. We don't support those old versions any more, so the workaround
has become unnecessary. It is still possible to initialize it manually if desired.
2022-07-19 19:57:38 +02:00
Andreas Schildbach
abc81d6d6e Transaction: remove the Android performance hack from getValue()
Mobile devices have become very powerful over the years, so a specific optimization
like this should not be needed.
2022-07-19 18:46:10 +02:00
Andreas Schildbach
9763a40a46 CoinSelection: fix JavaDoc by removing type argument 2022-07-19 16:54:25 +02:00
Andreas Schildbach
26f343a607 DefaultCoinSelector: use checked add to sum up output values 2022-07-19 10:28:10 +02:00
Andreas Schildbach
f6cb6c15d1 CoinSelection: add a new constructor that doesn't require valueGathered
We'll add the output values up ourselves.

This also deprecates the old constructor.
2022-07-19 09:37:27 +02:00
Sean Gilligan
fb6add760b ForwardingService: improve the implementation of close()
* Don't try to remove listener (access .wallet()) unless kit.isRunning()
* Don't wait for termination, just call kit.stopAsync()
* Add some JavaDoc
2022-07-19 09:28:42 +02:00
Sean Gilligan
498d638915 ForwardingService: properly handle shutdown
* ForwardingService to implement AutoClosable and use try-with-resources
* Add `kit.stopAsync()` and `kit.awaitTerminated()` in `close()`
2022-07-19 02:24:06 +02:00
Andreas Schildbach
9fc5d32abd ForwardingService: upper-case two constants 2022-07-18 23:23:39 +02:00
Andreas Schildbach
be744c2fe1 ForwardingService: infer network from address
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.
2022-07-18 23:05:44 +02:00
Sean Gilligan
165804965e ForwardingService: convert to CompletableFuture
* 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.
2022-07-18 21:55:47 +02:00
Andreas Schildbach
e1585cebac ForwardingService: print the hash of the forwarding transaction earlier 2022-07-17 19:53:11 +02:00
Andreas Schildbach
691cd46267 ForwardingService: limit the number of peer connections required
Nowadays on testnet or signet it takes a long time to discover enough bloom-enabled peers.
2022-07-17 19:42:57 +02:00
Sean Gilligan
50f46651b4 ForwardingService: move getPrefix() to end of file
This is meant to make the coming refactoring to CompletableFuture more
readable. It was in the middle of three main methods.
2022-07-17 00:13:19 +02:00
Sean Gilligan
95fb0ec3a4 ForwardingService: move println's and busy wait from waitForCoins() to forward()
This is in preparation for a refactoring to CompletableFuture, coming in a future commit.
2022-07-16 23:26:23 +02:00
Andreas Schildbach
c9835eb668 ForwardingService: support segwit addresses as receive address
This also potentially fixes the wallet not detecting incoming payments,
because it's looking for the wrong script type.
2022-07-16 22:54:30 +02:00
Andreas Schildbach
5259cc1d72 ForwardingService: replace copyright with generic statement 2022-07-16 21:44:04 +02:00
Sean Gilligan
ed525652a4 ForwardingService: extract method waitForConfirmation() 2022-07-16 11:52:28 +02:00
Sean Gilligan
68cacbebbc ForwardingService: rename one of the two forward() methods to clear up confusion 2022-07-16 11:42:37 +02:00
Sean Gilligan
a057cd04f6 ForwardingService: simplify argument parsing 2022-07-15 22:37:51 +02:00
Sean Gilligan
8e4cae391c ForwardingService: split main() into main() and forward() 2022-07-15 19:54:21 +02:00
Sean Gilligan
ccba23bd29 ForwardingSevice: add an address parameter to forwardCoins()
This makes forwardCoins() a little more generically-useful and
simplifies the coming conversion to CompletableFuture.
2022-07-15 15:59:28 +02:00
Sean Gilligan
a06134cc18 ForwardingService: simplify getPrefix()
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.
2022-07-15 15:53:43 +02:00
Sean Gilligan
e7b8508491 BitcoinNetwork: build name lists and map at init time
* In constructor create a list of all names
* Build static map of names to BitcoinNetwork at class initialization time
2022-07-14 16:19:12 -07:00
Sean Gilligan
dae9e0fff6 BitcoinNetwork: simplify declaration of alternateNames 2022-07-14 23:06:10 +02:00
Andreas Schildbach
95b063f3f4 ForwardingService: fix context not initialized 2022-07-14 10:44:50 +02:00
Andreas Schildbach
fb90c4458d Context: remove network parameters
This is the first step in the goal of making Context optional again,
using it only for configuration of a test environment.
2022-07-14 01:59:49 +02:00
Sean Gilligan
4098995a3c wallettemplate: migrate from NetworkParams to BitcoinNetwork in core classes
When base/core adds the ability to create an address from a `Network` we should
be able to use `Network`/`BitcoinNetwork` for everything.
2022-07-14 00:36:33 +02:00
Sean Gilligan
d29c80a1ed ForwardingService: use BitcoinNetwork.fromString() to parse network CLI parameter 2022-07-13 23:32:51 +02:00
Sean Gilligan
9f02cd2af3 WalletAppKit: add constructor with BitcoinNetwork, deprecate others
* 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
2022-07-13 22:59:17 +02:00
Sean Gilligan
e98b5e68fc NetworkParameters: make network final
* Make the private member `network` final.
* Constructor requires a network
* Update super() calls in subclasses
2022-07-13 22:20:35 +02:00
Sean Gilligan
665574add5 WalletTool: use BitcoinNetwork::toString for chain fileName 2022-07-13 22:09:47 +02:00
Andreas Schildbach
50ccb6b8fc Network: rename MAIN to MAINNET and TEST to TESTNET
The old, shorter names can be used as an alternate name so they will still be accepted for user-facing input.
2022-07-13 22:04:31 +02:00
Sean Gilligan
567d88e13f Network: uriScheme moved from NetworkParameters 2022-07-13 20:19:26 +02:00
Andreas Schildbach
932a871f86 BitcoinNetwork: allow a number of common alternate network names in fromString()
Also adds tests.
2022-07-12 15:15:38 +02:00
Sean Gilligan
60bad143ff BitcoinNetwork: simplify/standardize static factories and use lowercase strings for input/output
Also adds tests.
2022-07-12 01:05:04 +02:00
Sean Gilligan
b375a96565 BitcoinNetwork: of()/find() get by name, ofId()/findById() by ID 2022-07-11 09:43:05 +02:00
Andreas Schildbach
bca5faaba2 ForwardingService: fix testnet parameter in parseNetwork() 2022-07-10 20:51:24 +02:00
Sean Gilligan
42639c2d11 ForwardingService: add signet support 2022-07-10 00:05:40 +02:00
Sean Gilligan
24d0e68725 ForwardingService: move network argument parsing to parseNetwork()
Also adds an explicit "main" option.
2022-07-10 00:04:21 +02:00
Sean Gilligan
e5dc4f0c24 ForwardingService: remove unused imports 2022-07-09 23:39:32 +02:00
Sean Gilligan
cbe1833e04 ForwardingService: create singleton class, simplify main() 2022-07-09 22:24:15 +02:00
Sean Gilligan
d3599482c8 ForwardingService: extract getPrefix() 2022-07-09 22:21:18 +02:00
Sean Gilligan
a8e43b1b15 ForwardingService: use BitcoinNetwork where possible 2022-07-09 20:51:50 +02:00
Sean Gilligan
89fb6fe0a8 ForwardingService: extract requiredConfirmations to a variable 2022-07-09 12:18:22 +02:00
Sean Gilligan
0fa2876277 CONTRIBUTING.adoc: add Matrix room and other information
* Add the Matrix room
* Add more hyperlinks
* Add suggestion about asking before making big PRs
* Add link to documentation site and plea for help with it
2022-07-09 12:16:17 +02:00
Sean Gilligan
e78bb3438e NetworkParameters: deprecate getMonetaryFormat() 2022-07-08 08:21:58 -07:00
Sean Gilligan
d05aac598c CONTRIBUTING.md: convert to CONTRIBUTING.adoc 2022-07-08 11:28:17 +02:00
Sean Gilligan
a22dfaba64 README.md: convert to README.adoc
* Use `kramdoc README.md`
* Manually revert to ### style headings (to minimize delta)
* Manually revert 4 `-` literals to 3 ``` literals
* Manually remove some inserted blank lines
2022-07-08 11:28:15 +02:00
Sean Gilligan
80595e1a58 Network: hasMaxMoney(), maxMoney() moved from NetworkParameters
Deprecate methods in NetworkParameters/AbstractBitcoinNetParams.
2022-07-08 11:15:00 +02:00
Sean Gilligan
a4299dfb39 Network: add interface and implement in BitcoinNetwork enum 2022-07-06 17:26:00 +02:00