Commit Graph

71 Commits

Author SHA1 Message Date
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
Sean Gilligan
c41128b4df AesKey: replace o.bouncycastle.c.p.KeyParameter
We were using KeyParameter as a wrapper for a byte[] containing an
AES Key and passing it around our API. This introduced an unnecessary
API dependency on Bouncy Castle. This PR adds an AesKey class
for the same purpose to replace it.

This is a breaking change, but one that should be easy to accommodate.
2023-03-08 18:13:21 +01:00
Sean Gilligan
8bdc35a32e Wallet: migrate fromWatchingKeyB58() and fromSpendingKeyB58() methods to java.time API 2023-03-06 00:44:34 +01:00
Sean Gilligan
17abffa04b Peer: deprecate ping() and replace with sendPing()
1. Returns Duration rather than long
2. Uses CompletableFuture rather than ListenableCompletableFuture

I've also changed the error-handling a little. Instead of throwing
a ProtocolException (RuntimeException) if PingPong isn't supported
the exception is set in the CompletableFuture. We don't have anything
catching this exception, so wrapping it in the CompletableFuture seems
like a safe move.
2023-03-02 18:50:16 +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
Sean Gilligan
d86406ab2e TimeUtils: move (mock) time utils from o.b.core.Utils to new class 2023-02-27 19:32:50 +01:00
Sean Gilligan
1b0ac02eed ECKey, DumpedPrivateKey, EncodedPrivateKey: move to o.b.crypto package
Also move associated tests and test resources.
2023-02-24 10:49:35 +01:00
Sean Gilligan
0acfcb10ec PeerGroup: migrate constructors argument from NetworkParameters to Network
* Add 3 new constructors which take Network
* Deprecate (2 of 3) constructors that take NetworkParameters
* Mark 3-arg NetworkParameters constructor as @VisibleForTesting
2023-02-17 20:21:48 +01:00
Sean Gilligan
d354bc13ce Address, LegacyAddress, SegwitAddress, AddressParser: move to o.b.base
* Move related tests too
* Update imports in referencing classes
2023-02-16 22:50:02 +01:00
Andreas Schildbach
7b970e6001 build.gradle: update picocli to 4.7.1 2023-01-29 21:35:31 +01:00
Andreas Schildbach
8bd519624d build.gradle: update picocli to 4.7.0 2022-11-14 08:10:13 +01:00
Andreas Schildbach
83644530cd EncodedPrivateKey: migrate from NetworkParameters to Network 2022-08-17 09:34:04 +02:00
Andreas Schildbach
410b127176 DatabaseFullPrunedBlockStore: remove all database backed block stores
All of them are unmaintained and their tests are in the way of refactorings.
MySQL and Postgres had been disabled for a while, and one seems to care.
H2 is tested, but pulls a driver dependency into the test classpath.
2022-08-11 17:36:27 +02:00
Sean Gilligan
f59dc54ac8 Address: construct with and store Network, rather than NetworkParametesr
LegacyAddress, SegwitAddress: replace static factories that take NetworkParameters

* Add static factory methods that take `Network`
* Deprecate static factory methods that take `NetworkParameters`
* Add `Networks` support to `NetworkParameters.of(Network)`
* Update all usages to use the new methods
2022-08-11 02:40:33 +02:00
Andreas Schildbach
55d1919227 Address, LegacyAddress, SegwitAddress: migrate all usages of deprecated fromKey() to ECKey.toAddress() 2022-08-11 01:49:10 +02:00
Sean Gilligan
51f1d69e87 Address: deprecate fromString, replace with AddressParser
This change migrates from using `NetworkParameters` to `Network` for specifying the network and
also decouples from static methods in `Address` with an interface/implementation approach.

Note that there are 3 use cases for address parsing:

1. Any network is allowed - AddressParser.parseAddressAnyNetwork(String)
2. Parse for a specified network - AddressParser.parseAddress(String, Network)
3. Parse for a previously-specified (context dependent) network - AddressParser.Strict.parseAddress(String)

In most use cases, an AddressParser instance can be accessed through the Wallet,
which already knows the Network type and in this context validation for network makes
sense. This is why `Wallet` is implementing `AddressParser.Strict`

BitcoinURI allocates its own DefaultAddressParser for now, as do some other tests
and examples that don't have access to a Wallet

In the future DefaultAddressParser may be replaced by something loaded
via the ServiceLoader mechanism or other dynamically configured mechanism.
2022-08-03 18:14:48 +02:00
Sean Gilligan
28c2e2c7e3 Wallet: add network()
Perhaps in the future, we'll want a `network` private or protected member,
but for now that doesn't seem needed.

When we start using Network for address and transaction creation, this
will be used even more.
2022-08-02 12:00:47 +02:00
Sean Gilligan
900af2bde9 build.gradle: update JUnit 5 to 5.9.0 2022-07-28 20:50:06 +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
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
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
b8729f2fbd Network: rename to BitcoinNetwork
This is done in preparation for introducing a `Network` interface as a parent,
coming in a future commit.
2022-06-27 12:11:25 +02:00
Sean Gilligan
bfa6536942 org.bitcoinj.base: move Network to base 2022-06-26 20:05:09 +02:00
Sean Gilligan
a0b0392093 NetworkParameters: depend on Network enum, rather the reverse
This change makes NetworkParameters use and depend upon Network instead
of the reverse. This will allow Network to be moved to `base`.

Define `UnitTestParams` as being on the `TEST` network. We must choose
a `Network` property for `UnitTestParams` and I have learned through trial-and-error
that `TEST` is the correct choice.
2022-06-24 12:30:40 +02:00
Sean Gilligan
44d0576ce4 org.bitcoinj.base: move Base58, Bech32, AddressFormatException to base 2022-06-23 11:48:01 +02:00
Sean Gilligan
0645a835de org.bitcoinj.base: move Script.ScriptType to a top level type in base 2022-06-22 18:13:34 +02:00
Sean Gilligan
93cc0ac9c5 org.bitcoinj.base: move Sha256Hash and byte/math Utils members to base
* move o.b.core.Sha256Hash to o.b.base.Sha256Hash
* move byte and math utility methods from o.b.core.Utils to a new
  o.b.base.ByteUtils class
2022-06-22 17:40:50 +02:00
Sean Gilligan
84e737acdf org.bitcoinj.base: introduce new package that provides fundamental types with minimal dependencies
This also moves Coin, Fiat, its parent Monetary and the related MonetaryFormat into the new base package.

See the provided package-info.java for details.
2022-06-21 19:25:47 +02:00
Sean Gilligan
8f2757c0eb WalletTool: explicitly specify BIP32 in createWallet() 2022-05-03 20:04:16 +02:00
Sean Gilligan
e428cfbc04 wallet-tool: Add nativeCompile task for GraalVM
Also add graalvm.yml to do a nativeCompile build on Github Actions
2022-05-02 11:57:59 -07:00
Sean Gilligan
1283fe6f36 Network.java: remove PROD (alias for MAIN)
This affects the command-line UI of some tools, but since the `Network`
enum hasn't been released yet, we can remove it without deprecating
first.
2022-04-29 01:19:22 +02:00
Sean Gilligan
a6e5c88ce8 build.gradle: add detailed deprecation warnings to all modules 2022-04-19 10:07:55 +02:00