Commit Graph

103 Commits

Author SHA1 Message Date
Sean Gilligan
bce7bc195f WalletTool: eliminate reassignment of feePerVkb 2023-09-12 21:51:31 +02:00
Sean Gilligan
983febfad0 WalletTool: eliminate reassignment of coinSelector 2023-09-12 21:49:40 +02:00
Sean Gilligan
e186ef9c84 WalletTool: simplify coinSelector lambdas 2023-09-12 21:47:20 +02:00
Sean Gilligan
853aeebd81 WalletTool: use CoinSelector.fromPredicate()
Simplify creation of CoinSelectors by using `CoinSelector.fromPredicate()`.
2023-09-12 21:44:32 +02:00
Sean Gilligan
36dce3d9d5 wallet.proto, paymentrequest.proto: move generated files to dedicated packages
* Modify the `java_package` setting in our two `.proto` source files
 * Move 2 existing generated-but-checked-in Protos.java files to
   dedicated packages (i.e. packages without hand-coded "artisanal" files)

This is a step towards more compatibility with ProtoBuf tooling which
sometimes likes to delete the generated files and:

 > can't distinguish between "old generated code" and "your artisan source files."

and more importantly it is a step towards fixing Gradle 8 caching issues.
2023-07-28 21:55:26 +02:00
Sean Gilligan
6775635ce5 uild.gradle: update JUnit 5 to 5.10.0 2023-07-27 11:01:53 +02:00
Sean Gilligan
43021f4394 build.gradle: update picocli-codegen to 4.7.4 2023-07-27 10:59:23 +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
3284b6e309 build.gradle: update JUnit 5 to 5.9.3 2023-07-16 13:05:14 +02:00
Andreas Schildbach
ada7fae5aa build.gradle: update picocli to 4.7.4 2023-07-16 13:01:25 +02:00
Andreas Schildbach
63f72840c4 WalletTool: after send action, also print the entire transaction
Currently, only the transaction hash is printed.
2023-07-07 17:15:44 +02:00
Sean Gilligan
4a45c3b4f4 WalletTool: set peer address for RegTest network
On RegTest we need to add the `localhost` peer address to the
`PeerGroup` and set max connections to 1, to avoid calling peer
discovery.
2023-06-09 11:35:15 +02:00
Sean Gilligan
e76b28a8ca MultiplexingDiscovery: fix empty seeds precondition for RegTest
`checkArgument` should not throw with an empty seeds list _if_ running on RegTest.

The test is disabled because it requires a RegTest node that is advanced
1 block (typically via `generateblocktoaddres`) during the course of the test.
2023-06-04 16:35:49 +02:00
Sean Gilligan
d7c20ff73d WalletTool: convert wait() to return CompletableFuture
This change:
1. Shortens the code by 5 lines while adding many comments
2. Separates output to System.out from the async wait handling
3. Separates wallet/peerGroup setup and starting from async wait handling
4. Passes wait condition (along with wait-type enum) as a parameter

Behavior should be unchanged with the exception that the balance will
be output in the case that it "already meets the given condition".
2023-06-01 10:28:30 +02:00
Sean Gilligan
b8bfbcc658 WalletTool: fix --date option
Also adds tests for the `create` action.
2023-05-24 18:10:45 +02:00
Andreas Schildbach
d65aefd93e WalletTool: use an else branch rather than break (from a case) 2023-05-24 10:33:11 +02:00
Sean Gilligan
021ace195f WalletTool: convert method onChange() to a lambda
It is a method that is only used in one place and getting rid of it
should enable further simplification.
2023-05-24 10:23:55 +02:00
Sean Gilligan
784722370f WalletTool: replace WalletEventListener with lambdas 2023-05-23 12:35:36 +02:00
Sean Gilligan
dd92480401 WalletTool: fix two time-related deprecations 2023-05-23 11:21:40 +02:00
Sean Gilligan
7d00afc7a0 WalletTool: extract creation of SendRequest to private method
This is a step towards an immutable `SendRequest`.
2023-05-04 10:38:19 +02:00
Andreas Schildbach
4187f2328d MarriedKeyChain: remove married key chains
The current implementation is based on plain P2SH. I assume as of
today one would prefer an implementation based on taproot or at least
segwit (P2WSH).

Note the `isFollowing` and `sigsRequiredToSpend` fields in the
`DeterministicKey` message of the wallet protobuf are preserved for
now, because they might come in handy for a future implementation and
in general it's hard to remove fields from protobufs.

Also removes the `marry` action from `WalletTool`.
2023-04-28 23:07:49 +02:00
Andreas Schildbach
5db73f2d7a BitcoinURI: migrate to static from native constructors 2023-04-19 23:08:40 +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
Andreas Schildbach
838d14d027 PeerAddress: make immutable
* Static constructors `simple()` and `inet()` that replace the native constructors.
2023-04-13 00:21:36 +02:00
Andreas Schildbach
87bf6c0266 Transaction: make more use of getInput(index) 2023-04-08 16:33:41 +02:00
Andreas Schildbach
dedf478c66 Transaction: remove params from constructors 2023-04-03 16:23:13 +02:00
Sean Gilligan
23d1ce97b5 WalletTool: use net over params where possible
Note that `params` is initialized from `net`.
2023-03-31 21:01:16 +02:00
Sean Gilligan
04ff5335cf WalletTool: separate try block for setup/peerGroup.start in send()
This makes it more clear which operations throw `BlockStoreException`
and which throw `ExecutionException` or `InterruptedException`.
2023-03-31 20:58:01 +02:00
Sean Gilligan
1e088596df WalletTool: remove nested try in send()
This makes the code much more readable as you can see which operations
throw which exceptions and how they are handled.
2023-03-31 20:56:03 +02:00
Sean Gilligan
f41e5f2e1e WalletTool: remove explicit handling of KeyCrypterException from send()
`KeyCrypterException` is a runtime exception so there is no need
to catch and rethrow wrapped as a `RuntimeException`.
2023-03-31 20:52:34 +02:00
Sean Gilligan
786a1e1953 Script: migrate to Network from NetworkParameters
Provide deprecated methods for compatibility.
2023-03-31 01:23:27 +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
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
Andreas Schildbach
150c911750 LegacyAddress: flip arguments of new static constructor fromBase58()
Otherwise the deprecation cycle won't be of much use for consumers who pass `null` for `params`.
2023-03-27 09:17:37 +02:00
Sean Gilligan
6e1fc2cda9 WalletTool: rename tx from t in send() 2023-03-26 18:15:54 +02:00
Sean Gilligan
17f9b1dcfe WalletTool: don't unnecessarily reinitialize tx variable t in send() 2023-03-26 18:13:43 +02:00
Andreas Schildbach
7090c6a152 PaymentSession: rename time() method from getTime() 2023-03-18 11:06:17 +01:00
Andreas Schildbach
5db4e1eadd PeerFilterProvider: rename earliestKeyCreationTime() method from getEarliestKeyCreationTimeInstant() 2023-03-18 10:47:41 +01:00
Andreas Schildbach
e6e4745e1a Block: rename time() method from getTimeInstant() 2023-03-18 10:22:26 +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
de9c39b35a TimeUtils: migrate currentTime() method to java.time API 2023-03-14 02:56:52 +01:00
Andreas Schildbach
bb81790824 WalletTool: migrate date option to java.time API 2023-03-14 02:51:43 +01:00
Andreas Schildbach
168ff75bd1 TimeUtils: migrate dateTimeFormat() method to java.time API 2023-03-14 01:32:59 +01:00
Andreas Schildbach
be0b2b46b8 PaymentSession: migrate getters to java.time API 2023-03-10 16:43:09 +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
a61da4fff6 Script: migrate creationTime field to java.time API 2023-03-09 15:09:07 +01:00
Andreas Schildbach
18898f4fc5 Wallet, KeyChain, KeyChainGroup, PeerFilterProvider: migrate getEarliestKeyCreationTime() methods to java.time API 2023-03-08 20:41:46 +01:00