Sean Gilligan
02aa41e254
TestFeeLevel, DoubleSpend, SendRequest: construct WalletAppKit with BitcoinNetwork constant
...
This reduces usage of NetworkParameters in WalletAppKit-based examples and tools.
2022-08-01 10:00:06 +02:00
Andreas Schildbach
4842cdc6af
SPVBlockStoreTest: use TestNet3Params where possible, rather than UnitTestParams
2022-08-01 00:39:52 +02:00
Andreas Schildbach
58b07466f1
VersionMessageTest: use TestNet3Params, rather than UnitTestParams
2022-08-01 00:34:04 +02:00
Andreas Schildbach
2633910b0b
TransactionTest: use TestNet3Params where possible, rather than UnitTestParams
2022-08-01 00:30:57 +02:00
Andreas Schildbach
5293901cae
TransactionTest: fix context not initialized
2022-08-01 00:24:27 +02:00
Andreas Schildbach
1dd53f713f
TransactionInputTest: use TestNet3Params, rather than UnitTestParams
2022-08-01 00:13:10 +02:00
Andreas Schildbach
9e5d07cbc6
TransactionInputTest: fix context not initialized
2022-08-01 00:10:33 +02:00
Andreas Schildbach
f93a67b0c3
ChildKeyDerivationTest: use TestNet3Params, rather than UnitTestParams
2022-08-01 00:02:52 +02:00
Andreas Schildbach
996b2f4759
PaymentProtocolTest: use TestNet3Params, rather than UnitTestParams
2022-07-31 23:58:47 +02:00
Andreas Schildbach
58a6295db1
WalletProtobufSerializerTest: use TestNet3Params where possible, rather than UnitTestParams
2022-07-31 23:52:26 +02:00
Andreas Schildbach
e73d876be6
ParseByteCacheTest: fix context not initialized
2022-07-31 23:37:54 +02:00
Andreas Schildbach
4f150bbe96
MessageTest: use TestNet3Params, rather than UnitTestParams
2022-07-31 23:33:37 +02:00
Andreas Schildbach
90d6c21963
DeterministicKeyChainTest: use TestNet3Params, rather than UnitTestParams
2022-07-31 23:25:01 +02:00
Andreas Schildbach
027372cc60
ECKeyTest: use TestNet3Params, rather than UnitTestParams
2022-07-31 23:17:11 +02:00
Andreas Schildbach
17a4cd12a6
VersionTallyTest: use TestNet3Params where possible, rather than UnitTestParams
2022-07-31 23:14:09 +02:00
Andreas Schildbach
4b534f853d
AddressV1MessageTest, AddressV2MessageTest: use TestNet3Params, rather than UnitTestParams
2022-07-31 23:03:39 +02:00
Andreas Schildbach
20cee2c20c
BlockTest: fix context not initialized
2022-07-31 22:55:22 +02:00
Andreas Schildbach
9da6616d5a
Wallet: remove the output shuffling override for unit-tests
...
Only one unit-test was dependent on it. That test has been changed to manually disable the shuffling.
2022-07-31 21:19:39 +02:00
Andreas Schildbach
d95e825112
KeyChainGroup: remove the reduced lookahead for unit-tests
...
It turns out the effect on unit-test runtime is negligible these days.
2022-07-31 17:15:37 +02:00
Sean Gilligan
295ce50782
TransactionBroadcast: add broadcastOnly(), broadcastAndAwaitRelay() deprecate broadcast()
2022-07-31 12:28:18 +02:00
Sean Gilligan
2bd3a8bcde
TransactionBroadcast: use stream to simplify collecting sentFutures
2022-07-31 12:08:14 +02:00
Sean Gilligan
419dba9845
TransactionBroadcast: extract method dropPeerAfterBroadcastHandler(Peer)
...
Refactor the creation of this lambda to its own method.
2022-07-31 11:53:49 +02:00
Sean Gilligan
81fd758800
TransactionBroadcast: extract method broadcastOne(Peer)
...
* Move code to broadcast to one peer into broadcastOne(Peer) method
* Stop swallowing (but logging) exception thrown by peer.sendMessage(tx)
2022-07-31 11:37:31 +02:00
Sean Gilligan
e078421edd
Context: re-add constructors that take params
(as deprecated)
...
There are apps and libraries that are using these, we need to keep them as @Deprecated for
at least one release.
2022-07-30 14:13:40 +02:00
Andreas Schildbach
56419ded8e
TransactionBroadcast: fix missing brace in JavaDoc
2022-07-30 13:35:10 +02:00
Sean Gilligan
32c58ad723
TransactionBroadcast: internally create/complete sentFuture
...
* Add a private member called `sentFuture` that completes when the broadcast
is "sent" (written to buffer) to the broadcast peers
* Update the broadcast() method to track success/failure of the individual
broadcast messages and update sentFuture when the individual messages complete.
(This is done by using `thenComposeAsync`/`whenComplete`)
* Add comments and TODOs
2022-07-29 13:22:00 -07:00
Sean Gilligan
30595af6e4
ForwardingService: use collectingAndThen() to simplify forwardingCoinSelector()
2022-07-29 10:53:57 +02:00
Sean Gilligan
15d0134937
ForwardingService: static method to create CoinSelector
...
This uses partial function application rather than creating a class
to create the parent-transaction only CoinSelector.
2022-07-29 10:47:30 +02:00
Sean Gilligan
c89128c77b
TransactionBroadcast: make 2 private members final
2022-07-29 10:28:21 +02:00
Sean Gilligan
5a1536df3b
TransactionBroadcast: rename private future
to seenFuture
, add comments
2022-07-29 10:26:10 +02:00
Andreas Schildbach
adb6bcc921
ForwardingService: make the forwarding a safe operation
...
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.
2022-07-28 22:48:45 +02:00
Sean Gilligan
afe8086aec
TransactionBroadcast: simplify lambda and extract chooseBroadastPeers()
...
* Simplifies the lambda in broadcast:
** shortens it by two lines of code
** makes `peers` effectively final
** doesn't mutate the list `peers` with `shuffle`
* chooseBroadastPeers() gets JavaDoc
* chooseBroadastPeers() is more testable
2022-07-28 22:33:14 +02:00
Sean Gilligan
3754fa8d99
TransactionBroadcast: convert EnoughAvailablePeers to lambda
2022-07-28 21:24:12 +02:00
Sean Gilligan
3786d70de6
CoinSelection: encapsulate fields
...
* Encapsulate `valueGathered` as `totalValue()`
* Encapsulate `gathered` as `outputs()`
* Deprecate public members
* Update clients to use accessors
2022-07-28 21:03:36 +02:00
Sean Gilligan
e52e4d0e72
CoinSelection: require a List of outputs, rather than a Collection
...
Rationale:
* The comment says that it is a "list"
* Immutable Lists are the collection that maps most easily/logically to and from Stream
* Lists are easier to enforce reproducibility (mainly for unit tests)
2022-07-28 20:59:32 +02:00
Sean Gilligan
900af2bde9
build.gradle: update JUnit 5 to 5.9.0
2022-07-28 20:50:06 +02:00
Andreas Schildbach
e12ad507ba
WalletAppKitTest: fix using wrong annotation for disabling tests
2022-07-28 20:01:02 +02:00
Sean Gilligan
6b131a7780
WalletAppKitTest: new integration-test for WalletAppKit
2022-07-28 19:34:35 +02:00
Sean Gilligan
c2b4472f5c
WalletAppKit: give shutdownHook thread a name
2022-07-28 19:22:49 +02:00
Sean Gilligan
952751eee2
WalletAppKit: move shutdownHook into its own method
2022-07-28 19:18:01 +02:00
Andreas Schildbach
509694d9ad
ForwardingService: reduce redundant console output at startup
2022-07-28 15:00:20 +02:00
Sean Gilligan
62fecfa37c
ForwardingService: don't wait for blockchain synchronization before entering RUNNING state
...
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.
2022-07-28 14:45:07 +02:00
Sean Gilligan
6be2fd4999
ForwardingService: add directory parameter for wallet files
...
This will allow integration tests to put the files in a temporary directory
and is a good practice in general.
2022-07-28 13:27:03 +02:00
Sean Gilligan
368cdba42d
Peer, TransactionBroadcast: use thenRunAsync() instead of addListener()
...
Use CompletableFuture.thenRunAsync() rather than rely on the converter
method ListenableCompletableFuture.addListener().
2022-07-28 13:22:38 +02:00
Sean Gilligan
bee8427761
WalletAppKit: simplify blocking startup
...
* Use `startAsync()` for the blocking case, too. Since we were already
waiting on `downloadListner.await()`
* Make sure `installShutdownHook()` is called in both cases (bug fix)
* Add more comments
2022-07-28 01:07:07 +02:00
Sean Gilligan
ff674ea605
WalletAppKit: make sure downloadListener is never null
...
This simplifies the `if (blockingStartup)` and its `else` block. This change makes way
for further simplification.
2022-07-27 23:15:39 +02:00
Sean Gilligan
4bd79448ee
WalletAppKit: remove unnecessary try/catch in startUp()
...
Remove the very long try/catch in startup that catches BlockStoreException
and rethrows it wrapped in an IOException.
The Guava service base class (`AbstractIdleService`) that we are extending
allows us to throw `Exception` so there is no reason to wrap the exception
and it can just be thrown directly.
2022-07-27 12:36:52 -07:00
Sean Gilligan
54cd676560
StreamUtils: new util class with .toUnmodifiableList(), and use it
...
This will also make it easier to find and upgrade these
methods when we upgrade to newer JDKs.
2022-07-27 19:49:32 +02:00
Sean Gilligan
225551593d
Coin: improve JavaDoc
...
Also add explicit `throws ArithmeticException` on the
two BigDecimal conversion methods to match the `@throws`
in the JavaDoc.
2022-07-27 12:05:45 +02:00
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