Commit graph

5158 commits

Author SHA1 Message Date
Itoro Ukpong
ddcfe74182
Merge d9d7a080e5 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
Andreas Schildbach
93519cc65a BuildCheckpoints: add command line switch to enable logging 2025-03-09 21:21:18 +01:00
Andreas Schildbach
538833c906 ByteUtils: rename maxBytes parameter of bigIntegerToBytes()
It's a maximum allowed size rather than a constant size. The
`maxBytes` name makes this clearer.
2025-03-09 21:17:01 +01:00
Andreas Schildbach
1090649211 modular-architecture.md: make SLF4J uppercase
According to https://www.slf4j.org/, this is the correct spelling.
2025-03-01 12:21:12 +01:00
Sean Gilligan
e7545cafe3 modular-architecture.md: show SLF4J and JSpecify as dependencies of base
This is just a informational change. In the interest of keeping
the diagram simple, I have not been showing multiple links to minor direct
dependencies. But this change chooses to display SLF4J & JSpecify as
direct dependencies of `base`. This makes it more clear that
`base`, `core` and `wallet` all will depend on them. The diagram
still "lies" a little bit in not showing that they are also direct
dependencies, but I think that is an acceptable tradeoff for a diagram
that is easier to read.
2025-03-01 12:17:27 +01:00
Sean Gilligan
0e648bcba2 modular-architecture.md: update for planned 0.18 release
The main change here is that we are replacing the plan of migrating
the o.b.crypto module to it's own JAR and instead focusing on migrating
to the secp256k1-jdk API.
2025-03-01 12:17:27 +01: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
Andreas Schildbach
75dbe77080 graalvm.yml: drop Java 17 from the build matrix 2025-02-28 00:23:58 +01:00
Sean Gilligan
59ef01c7dd gradle.yml, graalvm.yml: update Gradle to 8.13 2025-02-27 22:00:47 +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
Sean Gilligan
e8ec153322 modular-architecture.md: indicate 0.17 is current release 2025-02-27 00:50:54 +01:00
Sean Gilligan
5edb96cbb8 Bech32: use ByteUtils.concat() in verifyChecksum() 2025-02-25 23:28:45 +01:00
Sean Gilligan
96835143db Bech32: make private verifyChecksum() throw on invalid checksum
This eliminates the last @Nullable annotation in the `base` module.

Since this is a private method and is called for every address
that is parsed, let's not use Optional<>, but move the throw from
decode() to verifyChecksum().
2025-02-25 23:23:18 +01:00
Sean Gilligan
7bbb841730 gradle.yml: make job name conform with graalvm.yml
This harmonizes the job names to make it easier to compare files.
2025-02-24 09:36:10 +01:00
Sean Gilligan
1f4454837d graalvm.yml: move java-version line
This is cosmetic only, but matches the order in
gradle.yml, to make diffs easier.
2025-02-24 09:32:15 +01:00
Sean Gilligan
ce54d42fbc gradle.yml, graalvm.yml: add JDK 23 to the build matrices 2025-02-24 09:29:43 +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
Sean Gilligan
6aaf7af52e graalvm.yml: rename matrix variable java from java-version 2025-02-19 22:21:51 +01:00
Sean Gilligan
9e1dd68a70 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:47:32 +01:00
Andreas Schildbach
3ebb1714de build.Containerfile: use cache for Gradle/Maven build artifacts 2025-02-10 21:39:49 +01:00
Andreas Schildbach
1d4fb63a60 build.Containerfile: use cache for Debian packages 2025-02-10 21:38:14 +01:00
Andreas Schildbach
80bdbbf86c build.Containerfile: only install Debian packages that are strictly necessary 2025-02-10 21:23:38 +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
Sean Gilligan
31be6f5d33 wallettemplate: modular build using jlink plugin
* add module-info.java
* wallettemplate/build.gradle: add jlink plugin and mainModule
* gradle.yml: add bitcoinj-wallettemplate:jlink Gradle target
* add instructions to the README
2025-01-30 14:15:04 +01:00
Sean Gilligan
b363afbc98 gradle.yml, README.adoc: add wallettemplate installDist target
Now that this target is working correctly, we can include it in the
GitHub Actions builds. We can also add instructions
for how to build to the README.

The GitLab CI is currently using Debian Gradle 4.4.1 and
DO NOT build wallettemplate, so they remain unchanged.
2025-01-30 10:36:34 +01:00
Sean Gilligan
d1b1a5cf26 build.gradle: more precise SLF4J dependency declaration
There is a compile-time dependency on slf4j-api and a runtimeOnly
dependency on slf4j-jdk14. This commit updates Gradle to declare this
explicitly.
2025-01-30 10:29:09 +01:00
itorod
a07b23d0e5 bitcoin_address.fxml: remove icon text for copy and qrcode icons 2025-01-29 23:33:05 +01:00
itorod
85c7c78854 bitcoin_address.fxml: replace fontawesomefx icons by PNGs
The PNGs are sourced from https://pictogrammers.com

This also gets rid of the dependency to fontawesomefx.
2025-01-29 22:18:23 +01:00
Sean Gilligan
d367fd2226 gradle.yml, graalvm.yml: update Gradle to 8.12.1 2025-01-27 11:00:29 -08: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
055f1362b3 build.gradle: update Kotlin to 2.0.21 2025-01-20 10:06:12 +01:00