Commit Graph

344 Commits

Author SHA1 Message Date
Andreas Schildbach
ba60554425 optimize imports 2024-08-21 13:32:13 +02:00
Andreas Schildbach
eb8b415d99 build.gradle: update SLF4J to 2.0.13 2024-08-03 10:16:36 +02:00
itorod
15b0ffeccb Kit: fix typo in printed string 2024-06-02 00:14:33 +02:00
Sean Gilligan
f268eb0cbf ForwardingService: remove listener properly
The listener wasn't being removed properly, because using a method
reference in both add and remove generated two different objects and
therefore the remove method wasn't finding and removing the listener
that was previously added.

By saving the listener created by the method reference, we can remove
it later.
2024-06-01 23:50:12 +02:00
Andreas Schildbach
781d64550b Script: rename getCreationTime() method from creationTime()
This effectively reverts commit b309308076.
2024-05-14 17:51:00 +02:00
Andreas Schildbach
2199c7a577 build.gradle: updade picocli to 4.7.6 2024-05-08 12:52:19 +02:00
Sean Gilligan
a68fdf1a3c examples: remove forwarding.py
This example is 8 years old, unsupported, and almost certainly doesn't work.
2024-04-29 09:25:22 +02:00
Sean Gilligan
a967a0f560 examples: remove JavaScript examples
These are old, unsupported, and almost certainly do not work as is.

We separately plan on replacing the JavaScript example on the documentation
site with a Kotlin example.
2024-04-29 09:23:46 +02:00
Sean Gilligan
a7c11c7019 ForwardingService: use Network.checkAddress(Address)
This makes things a little bit simpler and more readable.
2024-04-29 09:21:48 +02:00
Sean Gilligan
b257c6f4d8 ForwardingService: use BitcoinNetwork.strings() to build USAGE string
Use `BitcoinNetwork.strings()` for the list of valid `BitcoinNetwork` values
included in the USAGE string.
2024-04-23 19:20:14 +02:00
Sean Gilligan
ffcd879208 ForwardingService: inline CoinSelector creation into forward()
This also moves and adds comments.
2024-04-23 16:54:28 +02:00
Sean Gilligan
490b3fe956 ForwardingService: remove null-check in forwardingCoinSelector()
This is not strictly necessary, especially in a getting started example.
2024-04-23 16:46:58 +02:00
Sean Gilligan
c3e8b741ea ForwardingService: print network, not network.id()
Both the code and the output is simpler this way.
2024-04-23 16:43:07 +02:00
Sean Gilligan
cff6459b4e ForwardingService: let main() throw InterruptedException
This simplifies main() and increases readability.
2024-04-23 10:53:46 +02:00
Andreas Schildbach
5046ad3a49 build.gradle: update SLF4J to 2.0.12 2024-02-09 19:16:44 +01:00
Andreas Schildbach
89e190614a build.gradle: drop the Eclipse plugin
We assume that these days the plugin isn't needed to set up bitcoinj within
Eclipse.
2023-11-19 23:12:10 +01:00
Sean Gilligan
dfe8d3866c build.gradle: updade picocli to 4.7.5 2023-10-24 12:00:11 +02:00
Sean Gilligan
b8b64a339a build.gradle: update SLF4J to 2.0.9 2023-10-24 11:48:23 +02:00
Sean Gilligan
41885df896 PrintPeers: remove unused imports
This is the last Guava import in `examples`.
2023-09-30 18:33:13 +02:00
Sean Gilligan
d45cccc8d6 CoinSelector: new static method fromPredicate() to create CoinSelector
Use it in `ForwardingService`.
2023-09-01 18:38:14 +02:00
Sean Gilligan
21200c15cc ForwardingService: check existing forwardingCoinSelector() precondition
Check `parentTxId != null`.
2023-09-01 18:34:06 +02:00
Sean Gilligan
0bd5ed9b9b ForwardingService: make use of null-safe Objects.equals() 2023-09-01 18:31:31 +02:00
Sean Gilligan
e34dd300ec ForwardingService: fix possible NPE in coin selector 2023-08-08 21:38:16 +02:00
Sean Gilligan
d9a432b4d7 ForwardingService: extract method forward()
Move the code that creates the forwarded transaction, signs, sends,
and waits for peer confirmation into a standalone method.

The `forward()` function is a relatively straightforward asynchronous function
that returns a `CompletableFuture` that either completes normally or exceptionally.
2023-08-08 11:40:58 +02:00
Sean Gilligan
8cff8e0ac2 ForwardingService: print exception in coinForwardingListener
The listener was swallowing some exceptions. This change will
print those exceptions to the console.
2023-08-08 11:36:05 +02:00
Sean Gilligan
7efab37c6c DnsDiscovery, MultiplexingDiscovery: use Network in constructors 2023-07-27 10:56:06 +02:00
Sean Gilligan
dead2c74ab AddressParser: simpler address parsing by making it a @FunctionalInterface
We`re making `AddressParser` the `@FunctionalInterface` and a nested class
is used to define an `AddressParserProvider`
2023-07-18 23:54:59 +02:00
Sean Gilligan
39c34186cc BlockChain: use Network in constructors
Constructors that take NetworkParameters are marked as @VisibleForTesting.
This is because of the special UNITTEST NetworkParameters that is required for
certain tests.
2023-07-18 23:10:36 +02:00
Andreas Schildbach
ada7fae5aa build.gradle: update picocli to 4.7.4 2023-07-16 13:01:25 +02:00
Sean Gilligan
9291841f8d Wallet: use Network in static factory methods
* Adds new methods taking `Network` rather than `NetworkParameters`
* Deprecates all converted methods
* Updates tests, examples, and tools that use these calls
2023-04-18 12:47:09 +02:00
Sean Gilligan
5eb67285db Message: rename methods serialize() and messageSize()
Provide deprecated implementations of `bitcoinSerialize()`
and `getMessageSize()`.
2023-04-16 18:49:32 +02:00
Andreas Schildbach
838d14d027 PeerAddress: make immutable
* Static constructors `simple()` and `inet()` that replace the native constructors.
2023-04-13 00:21:36 +02:00
Sean Gilligan
e94d5a4b49 GenerateLowSTests: remove unused NetworkParameters 2023-04-10 01:49:15 +02:00
Andreas Schildbach
131b37f5d2 Script: make field chunks immutable
Also rename the accessor to `chunks()`.
2023-04-08 21:17:30 +02:00
Sean Gilligan
7ef88e709e TransactionOutPoint: make hash and index immutable
* Make the two fields `final`
* Rename accessors to `hash()` and `index()`
* Provide deprecated stubs for the old "get" methods
2023-04-04 00:06:47 +02:00
Andreas Schildbach
dedf478c66 Transaction: remove params from constructors 2023-04-03 16:23:13 +02:00
Andreas Schildbach
44b0ddeb59 Transaction: remove toHexString()
This makes a scary assumption on the format being used (segwit or not).
2023-04-01 10:25:15 +02:00
Sean Gilligan
772bccd5f8 MemoryBlockStore: construct with genesis block
It doesn't need an entire `NetworkParameters`.
2023-03-31 22:14:06 +02:00
Andreas Schildbach
eb531166ee TransactionOutput: remove params from constructors
To make this possible, a check for maximum value is removed.
2023-03-30 23:43:17 +02:00
Andreas Schildbach
773a9aeb4e PeerAddress: remove params from constructor
To make this possible, a port has to be specified in all cases.
2023-03-30 18:03:18 +02:00
Sean Gilligan
3b7c630eb4 ForwardingService: move args parsing to constructor
This simplifies the overall flow for tutorial purposes.
2023-03-27 23:23:44 +02:00
Sean Gilligan
65466f8908 ForwardingService: combine methods main() and forward() 2023-03-27 22:21:58 +02:00
Sean Gilligan
1b5fdcaa77 ForwardingService: use awaitRelayed() without extra thenApply() in coinForwardingListener() 2023-03-27 22:07:22 +02:00
Andreas Schildbach
8f504d3795 ForwardingService: return error code 1 on bad command line usage 2023-03-27 22:00:02 +02:00
Sean Gilligan
49290a8ce0 ForwardingService: rename coinForwardingListener from coinsReceivedListener 2023-03-27 21:43:59 +02:00
Sean Gilligan
a0c5501b4b ForwardingService: improve JavaDoc 2023-03-27 21:35:04 +02:00
Sean Gilligan
7cd8f80e44 ForwardingService: fix usage message 2023-03-27 21:32:24 +02:00
Sean Gilligan
3b6bdbad02 WalletAppKit: add launch() methods, simplify examples 2023-03-27 20:59:58 +02:00
Sean Gilligan
41ed5a984b Wallet: deprecate public fields in SendResult, replace with accessors
* Deprecate public fields in `SendResult`
* Make available equivalent accessors
* Update all usages

This prepares the way for replacing `SendResult` with `TransactionBroadcast`
in the future.
2023-03-27 20:22:35 +02:00
Sean Gilligan
774fde99fb Wallet: move methods sendTransaction() and waitForConfirmation() from ForwardingService
`waitForConfirmation()` now has two variants for convenience.
2023-03-27 19:30:27 +02:00