Commit Graph

4175 Commits

Author SHA1 Message Date
Sean Gilligan
1fa9bff490 ECKey, DeterministicKey: migrate API usages to Network from NetworkParameters 2023-02-27 11:45:05 +01:00
Andreas Schildbach
625adf55ea DeterministicKey: fix JavaDoc of deprecated serializePrivB58() 2023-02-27 11:40:33 +01:00
Sean Gilligan
232f194a36 DumpedPrivateKey: fix NPE in deprecated fromBase58() 2023-02-27 11:31:59 +01:00
Sean Gilligan
8ba45dd812 CrytoUtils: new internal utils, move sha256hash160() from Utils 2023-02-27 11:25:00 +01:00
Sean Gilligan
03782a4697 InternalUtils: move to o.b.base.internal package 2023-02-24 11:47:59 +01:00
Sean Gilligan
484b7185d4 VarInt: move to o.b.base package 2023-02-24 11:24:58 +01:00
Sean Gilligan
0d3c9780b0 SignatureDecodeException: move to o.b.crypto package 2023-02-24 11:21:11 +01:00
Sean Gilligan
0b865408e6 DRMWorkaround: remove workaround for AES-256 in older Java
Android and OpenJDK don't need this and I'm pretty sure that
Oracle JDK 9 and even recent builds of Oracle JDK don't need it either.
2023-02-24 10:55:45 +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
74821e3517 DefaultAddressParser: move from o.b.core to base 2023-02-24 09:45:59 +01:00
Sean Gilligan
aaf83be6f8 LegacyAddressTest, SegwitAddressTest: convert to Network from NetworkParameters
Finish conversion from NetworkParameters to Network in the tests. This cleans up
the code, too.

There are still some references to NetworkParameters in LegacyAddressTest:

1. Tests of deprecated methods that can be removed when those methods are removed
2. Tests that need getP2SHHeader() which hasn't moved to Network yet.
2023-02-24 09:33:10 +01:00
Sean Gilligan
10af4cdae9 NetworkParameters: migrate getSegwitAddressHrp() to Network.segwitAddressHrp()
Deprecate the old method.
2023-02-22 11:44:30 +01:00
Sean Gilligan
804e8cafec examples: always use BitcoinNetwork enum to specify network
* Replace all usages of *Net*Params.get() with BitcoinNetwork.* enum
* Where NetworkParameters is needed get it with NetworkParameters.of(network)

This change does the following:

* Makes it clear that BitcoinNetwork.* is the preferred method of specifying/declaring
  the active network.
* Prepares the way for examples to get the network string as a command-line arg
* Continues the general migration from NetworkParameters to Network
2023-02-21 18:54:37 +01:00
Sorn Županić Maksumić
b59cc7447d README.adoc: fix invalid option for value --net 2023-02-21 18:46:40 +01:00
Andreas Schildbach
e27baa1012 DefaultRiskAnalysisTest: fix context not initialized 2023-02-19 12:24:45 +01:00
Andreas Schildbach
bb3fb79f06 Message: deprecate method getHash()
It's not implemented anyways and only used as a generalization of some subclass implementations.
2023-02-19 10:56:23 +01:00
Sean Gilligan
a62ec7921e SegwitAddressTest: add two tests for P2WPKH REGTEST 2023-02-18 00:40:31 +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
micheal swiggs-malmevik
81ddf4f27e Script: remove deprecated method executeScript() 2023-02-17 20:11:40 +01:00
micheal swiggs-malmevik
54c85b2574 Script: remove a couple of deprecated pattern matchers
They had been moved to ScriptPattern.
2023-02-17 20:05:31 +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
Sean Gilligan
49f17929ac DefaultAddessParser: implement parse*AnyNetwork() methods 2023-02-16 19:48:06 +01:00
Sean Gilligan
0d6da641d8 BlockImporter: use switch statement for store argument 2023-02-16 12:01:26 +01:00
Sean Gilligan
e6a4dd4718 Wallet, WalletFiles: improve error handling on save
Catch FileNotFound error earlier and provide more informative
exception when it happens.

I discovered this issue running the WalletTool with an invalid directory
path to the wallet file. Before this fix the error/exception message is:

    java.io.IOException: No such file or directory

After the fix it is:

    java.io.FileNotFoundException: /Users/sean/bitcoinj (wallet directory not found)
2023-02-16 11:48:49 +01:00
Sean Gilligan
fd73170034 gradle.yml, graalvm.yml: update action versions to avoid Node.js 12 warning 2023-02-11 22:05:44 +01:00
Sean Gilligan
3f2a86b43e graalvm.yml: update GraalVM to 22.3.1 2023-02-11 21:50:50 +01:00
Sean Gilligan
7ec1c95b57 gradle.yml: update JDK to 19 in the build matrix 2023-02-11 21:45:20 +01:00
Sean Gilligan
d3d240b855 graalvm.yml: use official setup-graalvm action
Switch from the DeLaGuardo/setup-graalvm action to the "official"
graalvm/setup-graalvm action.
2023-02-11 21:02:20 +01:00
Sean Gilligan
545c1c8be7 gradle.yml, graalvm.yml: update Gradle to 7.6 2023-02-11 20:59:53 +01:00
micheal swiggs-malmevik
e283a832dd Message: deprecate unused property recached and its getter 2023-02-11 12:53:43 +01:00
micheal swiggs-malmevik
1b9b339720 BitcoinSerializer: remove redundant cursor incrementation 2023-02-09 15:40:22 +01:00
micheal swiggs-malmevik
3ff22bdf13 ChildMessage: remove deprecated constructor 2023-02-09 15:33:37 +01:00
Andreas Schildbach
a480bc3281 TransactionBroadcastTest: always compare txId with a txId 2023-02-09 14:39:34 +01:00
Andreas Schildbach
24a94ec981 Peer: make sure to not invoke the unimplemented Message.getHash()
This fixes the integration tests which were broken with the previous commit.
2023-02-09 14:37:56 +01:00
micheal swiggs-malmevik
7fa3730dbc Transaction: remove deprecated methods getHash(), getHashAsString() 2023-02-09 13:58:21 +01:00
micheal swiggs-malmevik
0869228cc4 Peer: remove deprecated method toStringServices() 2023-02-09 12:08:06 +01:00
Andreas Schildbach
2b5c50db25 Transaction: remove deprecated constant MIN_NONDUST_OUTPUT 2023-02-09 11:52:11 +01:00
micheal swiggs-malmevik
6a7ac8e2c7 NetworkParameters: remove deprecated method getMinNonDustOutput() 2023-02-09 11:46:22 +01:00
micheal swiggs-malmevik
ea5de696e8 Message: remove unused method hasMoreBytes() 2023-02-02 13:25:17 +01:00
micheal swiggs-malmevik
1477230f40 Peer: remove unused method isNotFoundMessageSupported() 2023-02-02 12:17:12 +01:00
micheal swiggs-malmevik
3950b88f76 BitcoinSerializer: remove unused parameter checksum in makeMessage() 2023-02-02 12:13:03 +01:00
Johannes Zweng
56e936d534
SegwitAddress: include length check for Taproot witness programs 2023-01-30 11:47:38 +01:00
Andreas Schildbach
aaeadb52c8 build.gradle: update protobuf-javalite to 3.21.12 2023-01-29 21:59:16 +01:00
Andreas Schildbach
27cc40a301 build.gradle: update EasyMock to 5.1.0 2023-01-29 21:52:41 +01:00
Andreas Schildbach
7b970e6001 build.gradle: update picocli to 4.7.1 2023-01-29 21:35:31 +01:00
Johannes Zweng
fa2d3b3db6 MessageVerifyUtils: add util for verifying signed messages
Since P2SH-P2WPKH addresses do not contain the public itself – but instead
a value derived from a pubkey, namely
RIPEMD160(SHA256(0x00 0x14 <20-byte-pubKeyHash>)) - the verification of
signed messages got a bit more complicated (and different per address
type). To encapsulate this complexity and make it easy to use, this commit
introduces a new util class for verifying signed Bitcoin messages.

It also adds some test vectors partly from other projects implementing
the same functionality to test interoperability, as well as some publicly
known messages and signatures.
2022-12-18 12:01:59 +01:00
Johannes Zweng
070e53889e ECKey: add BIP 137 support for signing text messages with segwit addresses
BIP 137 defined new header byte values for the created signature
when the signature was created with a private key from a segwit
address.

This commit extends the "signMessage(..)" with a new ScriptType argument
(because the value of the signature header since BIP 137 depends on the
address type). This commit keeps the old methods (without the ScriptType
argument), but marks them as deprecated (using P2SH as default, if called
without ScriptType, thus not changing old behaviour).
2022-12-18 12:00:44 +01:00
Johannes Zweng
e4f6dbd866 ECKey: add BIP 137 support for verifying signatures from segwit addresses
BIP 137 extended the allowed range of values for the header byte
of signatures (for signatures created from segwit addresses).
This commit reflects these changes and adds the newly allowed
header byte values to ECKey.signedMessageToKey(...).

Also adds test cases verifying signatures created with segwit addresses.
2022-12-18 11:59:57 +01:00
Andreas Schildbach
bc27caaae0 build.gradle: update protobuf-javalite to 3.21.10 2022-12-04 20:03:08 +01:00
Andreas Schildbach
adcba44ae0 SeedPeers: add a constructor for InetSocketAddress
The old `int` format for peer addresses is now deprecated, as it doesn't support IPv6.
2022-12-04 13:36:45 +01:00