Commit graph

4068 commits

Author SHA1 Message Date
Sean Gilligan
ab8792c07e
Merge 5c17cf4c08 into 40b1ac351f 2025-03-11 12:21:09 -05:00
Andreas Schildbach
40b1ac351f StoredBlock: if getPrev() called on a genesis block, cut short
Don't try to locate a previous block of the genesis block, using
an arbitrary "previous block hash".
2025-03-10 23:28:38 +01:00
Andreas Schildbach
284fbcc20f SPVBlockStore: fix get() locates an invalid block if called with zero hash
This happens if the store is relatively fresh and has not yet fully wrapped
around at least once. Thus, entire entries of the ring buffer are still
zeroed, and in particular the hash field of store entries will be zero. In
consequence, get() is locating and returning an invalid block when asked to
look for the zero hash.

Valid blocks that hash to zero will require an astronomical amount of
mining. So we fix this bug by hardcoding the zero hash to never be found in
our store.

Includes a test for this edge case.
2025-03-10 10:56:24 +01:00
Sean Gilligan
5c17cf4c08 Use Bouncy Castle bcprov-jdk18on from secp-bouncy 2025-03-05 10:33:45 -08:00
Sean Gilligan
276ecb16c5 Add secp-api, secp-bouncy and a smoke test 2025-03-05 09:55:52 -08:00
Andreas Schildbach
8c4118882d PaymentProtocol, PaymentSession: completely remove BIP70
The payment protocol had its time, but nowadays nobody is using it
any more. Let's leave it behind.
2025-02-28 18:42:38 +01:00
Andreas Schildbach
aa9eaf9af7 NetworkParameters: remove deprecated constants and methods related to BIP70 2025-02-28 01:39:38 +01:00
Sean Gilligan
8070bd80e6 GuardedBy: use internal annotation rather than from external library
Also remove the jcip-annotations dependency from core.
2025-02-27 21:08:17 +01:00
Andreas Schildbach
455a874950 Peer: reduce logging when fee filter is announced to us 2025-02-19 22:47:22 +01:00
Andreas Schildbach
9bf97c997b NioClientManager: reduce logging for the happy path
It's up to higher-level classes like Peer to provide reasonable logging
for successful connections.
2025-02-19 22:44:48 +01:00
Andreas Schildbach
9e143a919e PeerGroup: remove redundant log message when download peer dies
It's always

```
Download peer died. Picking a new one.
Unsetting download peer: <peer>
Setting download peer: <peer>
```

So the first message can go away.
2025-02-19 22:43:35 +01:00
Andreas Schildbach
6f0dae931a ConnectionHandler: reduce log for CancelledKeyException
* log without stacktrace
* reduce log level to info
2025-02-19 22:42:02 +01:00
Andreas Schildbach
446f8a213d NioClientManager: reduce log for IOException
* log without stacktrace
* reduce log level to info
2025-02-19 22:40:31 +01:00
Sean Gilligan
47441d397a TransactionBroadcast: fix minor typos in comment 2025-02-19 22:38:51 +01:00
Sean Gilligan
561ce2a868 Transaction: fix typos in comments and exception message 2025-02-19 22:30:28 +01:00
Andreas Schildbach
92a4feb8d6 MainNetParams, TestNet3Params, SigNetParams: update DNS seeds from Bitcoin Core 28.1 2025-02-10 21:09:03 +01:00
Andreas Schildbach
85d9d3e881 Transaction: cache transaction IDs
Without caching, transactions are serialized way too often.

This effectively reverts b8d3c4a641, but
invalidation is slightly different.
2025-02-10 19:19:34 +01:00
Andreas Schildbach
179fb049fa TransactionWitness: add missing class and method JavaDoc 2025-02-10 18:09:33 +01:00
Andreas Schildbach
7efdd39bc1 TransactionInput: make field scriptBytes immutable
Because tweaking is necessary for transaction signing, these usages
have been changed to produce new inputs instead and replace them in
transactions as needed.
2025-02-10 01:05:35 +01:00
Andreas Schildbach
fbf836d2ca TransactionInput: make field witness immutable
Because tweaking is necessary for transaction signing, these usages
have been changed to produce new inputs instead and replace them in
transactions as needed.
2025-02-10 00:59:40 +01:00
Andreas Schildbach
60f949aa17 TransactionInput: make field sequence immutable
Because tweaking is necessary in cases like unit tests, these usages
have been changed to produce new inputs instead and replace them in
transactions as needed.
2025-02-10 00:46:23 +01:00
Andreas Schildbach
9daf18eb0f TransactionOutput: make field value immutable
Because tweaking is necessary for fee calculation logic, these usages
have been changed to produce new TransactionOutputs instead and
replace them in transactions as needed.
2025-02-09 01:47:53 +01:00
Andreas Schildbach
3f3b73fc09 TransactionOutput: make field scriptBytes immutable 2025-02-08 10:33:12 +01:00
Andreas Schildbach
4e88ff284d ScriptBuilder: if pushing an empty data, use data() not smallNum()
Pushing an empty data is *not* a no-op: an item is added to the
stack. So that empty array should be represented in the data
part of the script chunk.

This makes behaviour consistent with script parsing, and input
signing expects the empty array as a placeholder for a missing
signature.

This reverts 07682145e3 from 2015!

Also adds a test.
2025-02-08 02:19:59 +01:00
Andreas Schildbach
c35f320e89 TransactionInput, TransactionOutPoint: in write(), prefer calling write() over serialize()
The reason is `write()` re-uses the `ByteBuffer`, whereas `serialize()` allocates
an intermediate byte array.
2025-02-05 13:57:09 +01:00
Andreas Schildbach
1152c3b751 SPVBlockStore: make sure to use position(int) only from Buffer rather than MappedByteBuffer
Without this cast, on some old JDKs it links against an overloaded method in MappedByteBuffer
and Android doesn't have it.
2025-01-27 16:08:19 +01:00
Omoniyi Ilesanmi
cd48efe15b Wallet: rename TransactionCompletionException from CompletionException
This avoids naming confusion with `java.util.concurrent.CompletionException`.
2025-01-23 10:28:51 +01:00
Andreas Schildbach
4c70646ab7 checkpoints.txt: refresh bundled checkpoints 2025-01-19 23:42:07 +01:00
Andreas Schildbach
0ba1682a42 build.gradle: update protobuf-javalite to 4.29.3 2025-01-19 21:31:53 +01:00
Andreas Schildbach
04e400ea10 build.gradle: update equalsverifier to 3.18.1 2025-01-19 21:31:53 +01:00
Andreas Schildbach
e46100650f build.gradle: update Jackson to 2.18.2 2025-01-19 21:13:39 +01:00
Andreas Schildbach
bddcf9d2ca build.gradle: update EasyMock to 5.5.0 2025-01-19 21:07:58 +01:00
Andreas Schildbach
e229bb5e91 build.gradle: update Guava to 33.4.0-android 2025-01-19 20:58:20 +01:00
Andreas Schildbach
3956d6cf16 build.gradle: update Bouncy Castle to 1.80 2025-01-17 10:09:46 +01:00
Sean Gilligan
09defa6266 ECKey: add JavaDoc for toAddress() 2025-01-03 11:32:21 +01:00
Andreas Schildbach
25ff2243cd ScriptPattern: simplify isWitnessCommitment() and extractWitnessCommitmentHash()
It now operates on bytes, rather than chunks. This also adds a bit of JavaDoc
and a couple of tests.
2024-12-09 15:02:25 +01:00
Andreas Schildbach
be91b31440 Script, ScriptBuilder: don't use current time as a default for creationTime
Rather, leave it `null`.
2024-12-03 13:18:28 +01:00
Andreas Schildbach
7a32e7ad4d build.gradle: update equalsverifier to 3.17.3 2024-11-19 13:53:23 +01:00
Andreas Schildbach
14dfd3870c build.gradle: update protobuf-javalite to 4.28.3 2024-11-19 13:46:09 +01:00
Andreas Schildbach
c36a6ff51c build.gradle: update SLF4J to 2.0.16 2024-11-19 13:31:24 +01:00
Andreas Schildbach
50ebb54a8a build.gradle: update Guava to 33.3.1-android 2024-11-19 13:25:45 +01:00
Andreas Schildbach
5e29a9eba7 build.gradle: update Bouncy Castle to 1.79 2024-11-09 12:52:42 +01:00
Andreas Schildbach
24fb83c2fe Script, ScriptBuilder: clarify concept of creation time in the JavaDocs 2024-11-09 12:48:36 +01:00
Andrey
e0c20f2bb0 build.gradle, settings.gradle: simplify Gradle version comparisons 2024-10-18 10:08:48 +02:00
Sean Gilligan
87f4114774 ScriptChunk: deprecate write(OutputStream)
Deprecate write(OutputStream) and replace with existing
toByteArray() method. Internally implement a write(ByteBuffer) method.

Update Script to use chunk.toByteArray().
2024-09-27 15:19:43 +02:00
Sean Gilligan
40a7cefe82 Script: two private constructors for clarity
This also makes parameter validation more consistent.
2024-09-26 00:26:58 +02:00
Sean Gilligan
0cb413cc4f Script: functional-style parseIntoChunks(), parseIntoChunksPartial() 2024-09-25 15:25:46 +02:00
Sean Gilligan
c97c9f8f06 Script: annotate program as @Nullable
This reflects current design and behavior.
2024-09-25 15:21:53 +02:00
Sean Gilligan
32cdb9fa8b ListenableCompletableFuture, ListenableCompletionStage: complete migration to CompletableFuture
Release 0.17 was the transition release to allow users
to migrate from ListenableFuture to CompletableFuture.
In Release 0.18 we are removing ListenableCompletableFuture and
ListenableCompletionStage and changing method signatures to
return CompletableFuture.

This is technically a breaking change and, of necessity, we weren't
able to mark everything that is going away as "deprecated", but
we did put a special notice in the 0.17 release notes and the migration
should not be too difficult.
2024-09-04 10:37:34 +02:00
Sean Gilligan
d245256b96 ListenableCompletableFuture, ListenableCompletionStage: add deprecations/warnings
If we deprecate these two classes, there will be no way for callers to
get rid of the deprecation warnings.

Instead, I've added **bolded** warnings in the JavaDoc for each class
**and** deprecated all their methods.

I also removed the "When the migration is finished" paragraphs in the
JavaDoc.
2024-09-04 01:08:08 +02:00