Commit graph

5090 commits

Author SHA1 Message Date
Andreas Schildbach
8cbd09438c 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:31:16 +01:00
Andreas Schildbach
9e91ae629e 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 23:20:07 +01:00
Sean Gilligan
bfac33ab6d modular-architecture.md: indicate 0.17 is current release 2025-02-27 00:54:44 +01:00
Andreas Schildbach
40f97cb95a prepare 0.17.1-SNAPSHOT 2025-02-27 00:54:44 +01:00
Andreas Schildbach
f1b503095d tag 0.17 2025-02-21 10:37:41 +01:00
Andreas Schildbach
edae2f7420 Peer: reduce logging when fee filter is announced to us 2025-02-19 22:48:10 +01:00
Andreas Schildbach
0942bf82ea 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:45:44 +01:00
Andreas Schildbach
e085d3c988 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:44:01 +01:00
Andreas Schildbach
673f4f4fdb ConnectionHandler: reduce log for CancelledKeyException
* log without stacktrace
* reduce log level to info
2025-02-19 22:42:39 +01:00
Andreas Schildbach
26726f4648 NioClientManager: reduce log for IOException
* log without stacktrace
* reduce log level to info
2025-02-19 22:41:10 +01:00
Sean Gilligan
f59e6ce118 TransactionBroadcast: fix minor typos in comment 2025-02-19 22:39:32 +01:00
Sean Gilligan
7169810a99 Transaction: fix typos in comments and exception message 2025-02-19 22:32:42 +01:00
Sean Gilligan
84aadfeee0 graalvm.yml: rename matrix variable java from java-version 2025-02-19 22:26:58 +01:00
Sean Gilligan
0f1d02e40d gradle.yml, graalvm.yml: update gradle-build-action to setup-gradle@v4
See https://github.com/gradle/actions/releases for changes.
2025-02-19 12:48:30 +01:00
Andreas Schildbach
9bd4c41001 prepare 0.17-SNAPSHOT 2025-02-19 12:45:26 +01:00
Andreas Schildbach
84f2a14bd8 tag 0.17-rc3 2025-02-10 22:04:02 +01:00
Andreas Schildbach
e8b457b15b build.Containerfile: use cache for Gradle/Maven build artifacts 2025-02-10 21:42:30 +01:00
Andreas Schildbach
9a88527465 build.Containerfile: use cache for Debian packages 2025-02-10 21:41:53 +01:00
Andreas Schildbach
391e9d5d77 build.Containerfile: only install Debian packages that are strictly necessary 2025-02-10 21:27:05 +01:00
Andreas Schildbach
954cd5eb93 MainNetParams, TestNet3Params, SigNetParams: update DNS seeds from Bitcoin Core 28.1 2025-02-10 21:20:58 +01:00
Andreas Schildbach
e57e21cc98 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:18:56 +01:00
Andreas Schildbach
2f7579d797 TransactionWitness: add missing class and method JavaDoc 2025-02-10 19:15:58 +01:00
Andreas Schildbach
c4b575d503 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:14:37 +01:00
Andreas Schildbach
0f940bd4d0 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 01:14:37 +01:00
Andreas Schildbach
7fdef658a7 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 01:14:37 +01:00
Andreas Schildbach
1dc99408bc 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-10 01:14:37 +01:00
Andreas Schildbach
b237a34d8b TransactionOutput: make field scriptBytes immutable 2025-02-10 01:14:37 +01:00
Andreas Schildbach
acd0faaec7 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-10 01:14:35 +01:00
Andreas Schildbach
f7c7e421fc 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-08 02:10:29 +01:00
Andreas Schildbach
a5aaa8924a 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:12:49 +01:00
Omoniyi Ilesanmi
2cdeabf02c Wallet: rename TransactionCompletionException from CompletionException
This avoids naming confusion with `java.util.concurrent.CompletionException`.
2025-01-23 10:41:04 +01:00
Andreas Schildbach
f8b19bac81 prepare 0.17-SNAPSHOT 2025-01-23 10:24:46 +01:00
Andreas Schildbach
8a347d4076 tag 0.17-rc2 2025-01-21 12:29:37 +01:00
Andreas Schildbach
d2dd69aaa9 build.gradle: update Kotlin to 2.0.21 2025-01-20 10:57:39 +01:00
Andreas Schildbach
89b3955e5c build.gradle: update Gradle plugin for GraalVM to 0.10.3 2025-01-20 10:35:23 +01:00
Andreas Schildbach
24458e4fc1 gradle.yml, graalvm.yml: update Gradle to 8.12 2025-01-20 10:18:16 +01:00
Andreas Schildbach
b7eba1d8f1 checkpoints.txt: refresh bundled checkpoints 2025-01-19 23:41:05 +01:00
Andreas Schildbach
8c370824f7 build.gradle: update protobuf-javalite to 4.29.3 2025-01-19 23:06:59 +01:00
Andreas Schildbach
1f2d1d5fe8 build.gradle: update equalsverifier to 3.18.1 2025-01-19 22:54:32 +01:00
Andreas Schildbach
9a4f311c53 build.gradle: update Jackson to 2.18.2 2025-01-19 22:45:14 +01:00
Andreas Schildbach
80da45f6f6 build.gradle: update EasyMock to 5.5.0 2025-01-19 22:35:00 +01:00
Andreas Schildbach
c6bc5b6f0d build.gradle: update JUnit 5 to 5.11.4 2025-01-19 22:22:48 +01:00
Andreas Schildbach
48f74b8ff1 build.gradle: update Guava to 33.4.0-android 2025-01-19 22:09:20 +01:00
Andreas Schildbach
1ab2af87ad build.gradle: update Bouncy Castle to 1.80 2025-01-19 21:57:16 +01:00
Andreas Schildbach
cc604f8e5f gradle.yml, graalvm.yml: update Ubuntu to 24.04 2025-01-16 20:13:34 +01:00
Sean Gilligan
53cafe1b03 ECKey: add JavaDoc for toAddress() 2025-01-03 11:37:31 +01:00
Andreas Schildbach
2223d38cad prepare 0.17-SNAPSHOT 2025-01-03 11:37:12 +01:00
Andreas Schildbach
bc255a34c0 tag 0.17-rc1 2024-12-16 17:09:20 +01:00
Andreas Schildbach
c88e973826 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-14 14:27:46 +01:00
Andreas Schildbach
2589c0d7fc Script, ScriptBuilder: don't use current time as a default for creationTime
Rather, leave it `null`.
2024-12-03 13:14:06 +01:00