Commit Graph

329 Commits

Author SHA1 Message Date
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
Sean Gilligan
b24964d056 TransactionBroadcast: add awaitRelayed(), deprecate future()
* Add `awaitRelayed()` method that returns a CF that completes when relaying is confirmed.
* Deprecate `future()` and reimplement it using `awaitRelayed()`.
2023-03-27 18:38:15 +02:00
Andreas Schildbach
b528fb5180 build.gradle: update SLF4J to 2.0.7
Starting with SLF4J 2.0.0, we can use the fluent logger API.
2023-03-27 15:25:02 +02:00
Sean Gilligan
b13fe5a5d2 ForwardingService: make coinsReceivedListener() use wallet parameter
...instead of `kit.wallet()`.
2023-03-27 09:11:17 +02:00
Sean Gilligan
3ad07ea28c ForwardingService: rename forwardingCoinSelector() parameter
...to `parentTxId` (which is more clear and correct)
2023-03-27 09:08:27 +02:00
Sean Gilligan
884072c9e3 WalletAppKit: make Closeable 2023-03-26 19:40:28 +02:00
Sean Gilligan
84c8a2887a ForwardingService: make Closable not AutoCloseable
`Closeable` implements `AutoCloseable` but narrows the exception thrown
from `Exception` to `IOException`. ForwardingService.close() currently
doesn't throw any exceptions.
2023-03-26 19:37:08 +02:00
Sean Gilligan
f58d07a623 ForwardingService: start() returns receiving address 2023-03-26 18:10:09 +02:00
Andreas Schildbach
04c72ce003 Peer: migrate pingIntervals field to java.time API 2023-03-19 20:15:00 +01:00
Andreas Schildbach
b309308076 EncryptableItem: rename creationTime() method from getCreationTime() 2023-03-18 11:23:05 +01:00
Andreas Schildbach
9ec245c259 Objects: migrate entire codebase to requireNonNull() from Guava Precondition.checkNotNull()
This has the added benefit of exception messages being evaluated on demand.
2023-03-16 20:12:28 +01:00
Andreas Schildbach
54754e14e9 EncryptableItem, ECKey, DeterministicKey, DeterministicSeed: migrate creationTime field to java.time API 2023-03-10 09:28:27 +01:00
Sean Gilligan
3023947df8 ByteUtils: move to o.b.base.internal
We don't consider ByteUtils to be part of our external API.
2023-03-10 01:28:23 +01:00
Andreas Schildbach
92ee36848c DeterministicSeed: introduce static constructors meant for external consumers
* native constructors that were meant to be called by consumers now have static equivalents
* all native constructors are discouraged from being used by a JavaDoc comment
* one constructor that wasn't meant to be used by consumers is switched to private access
* tests and tools that resemble consumers are updated to use the new API

Note: although most native constructors are now deprecated, we're not using
annotations because we're still calling them.
2023-03-10 00:53:35 +01:00
Andreas Schildbach
913f5ac8c6 PeerDiscovery: migrate getPeers() to java.time API 2023-03-03 00:10:35 +01:00
Sean Gilligan
916989a7cd ByteUtils: replace HEX (Guava BaseEncoding) with with own implementation
* Deprecate ByteUtils.HEX
* Migrate usages to new ByteUtils.formatHex() and ByteUtils.parseHex()
* Direct use of Guava BaseEncoding in tests that use some specific
  features of BaseEncoding that aren't provided by new methods.
2023-03-02 15:16:06 +01:00