Commit graph

1756 commits

Author SHA1 Message Date
Calin Culianu
01ed27b200
Remove dead code: CityHash unused code (always compiled out)
Nothing in the app relies on it, and the conditional compilation offered
could potentially cause problems. Removed.
2026-08-07 13:49:29 -05:00
Calin Culianu
6d542e139d
Nit in ByteView class; add 'iterator' 2026-08-07 12:39:08 -05:00
Calin Culianu
eba8431a0b
API nit: Use Util::AsyncOnObject everywhere instead of QTimer::singleShot
This is just to make the API easier to follow. Also cleaned up
AsyncOnObject to not default to caarse timer unless the interval is
>2000 msec.

Also we use QMetaObject::invokeMethod() directly by default if the
AsyncOnObjectCall() has when_ms <= 0 (default).

This should have no real observable change on app behavior other than
being a code cleanup & nit.
2026-08-03 23:45:42 -05:00
Calin Culianu
92fd99fee8
docker based static builder: Allow arm64 (aarch64) hosts
This commit allows aarch64 and/or arm64 hosts to cross-build
for amd64 docker targets (the reverse was always supported).

This commit is needed because now I run an Apple Silicon Mac and I'd
like to be able to cross-build to x64_64.
2026-07-23 21:41:38 -05:00
Calin Culianu
4b38a7590e
Minor tiny nit in Mempool.cpp, benchmarks 2026-05-10 07:37:40 -05:00
Calin Culianu
4e8f7edaf9
Some nits in BlockProc.cpp and Mempool.cpp
- Prefer C++20 named initializers to the older C-like method
- Use `const bool TRACE` in a few more places.
2026-05-10 07:26:51 -05:00
Calin Culianu
4f4ef699ce
Fixed a typo in a comment 2026-05-09 23:19:18 -05:00
Calin Culianu
810dc2a759
Small nit to avoid theoretical but not actual UB in Storace/Compat.cpp 2026-05-07 21:27:44 -05:00
Calin Culianu
bb2fc1a9e9
Bumped electrum-cash-protocol submodule 2026-05-07 19:10:56 -05:00
Calin Culianu
f06d28f99e
Bumped version to 2.1.1
In preparation for release
2026-05-07 17:46:01 -05:00
Calin Culianu
84533da6f6
Windows build: wine64 -> wine
`wine64` binary seems gone, just use `wine`.
2026-05-07 17:37:59 -05:00
Calin Culianu
4b32f206d9
Follow-up; added an extra check in token tests 2026-05-05 22:28:19 -05:00
Calin Culianu
c43be6773b
Some minor nits and tweaks
Just some fixes to code quality and formatting. Minor nits.
2026-05-05 22:25:29 -05:00
Calin Culianu
cc98c3c74f
Pulled latest changes from BCHN sources for: bitcoin/token.h
Minor nit in preparation for the May 2026 upgrade.

The only change really is that when working with token serializations,
we pre-allocate more space for token commitments in EstimatedSerialSize()
which now expects up to 128 byte commitments.

Otherwise everything is the same, pretty much.
2026-05-04 00:35:02 -05:00
Calin Culianu
8d8453dc3a
Moved the code to figure out rocksdb version into Storage/Compat.cpp
It was kinda specialized code that tried to react to the exact rocksdb
version we are running and/or compiling against and figure out the version
and commit hash of rocksdb.

It really just belongs in Storage/Compat.cpp and not in Storage.cpp itself.
2026-04-24 19:11:18 -05:00
Calin Culianu
183076ea4f
Fix for compile issue with rocksdb v11 or greater
The rocksdb team removed the long-standing "raw pointer"
rocksdb::DB::Open() API in favor of the unique_ptr version.

The reason we were using the raw pointer version is because it was more
compatible with older versions, including the one that ships with
Fulcrum.

As a result we were forced to create a "Compat" later in Storage/ for
rocksdb::DB::Open that smoothes over the differences. This commit just
makes all calls to rocksdb::DB::Open() in the codebase go through
Compat::DBOpen.
2026-04-24 18:29:28 -05:00
Calin Culianu
ea21678240
Fixed a typo in a test 2026-04-22 12:36:08 -05:00
Calin Culianu
53cf4f7a47
On unclean shutdown, lower the number of blocks we undo to 1
Undoing the blocks anyway is mainly pointless due to rocksdb guarantees
and was added as a paranoia measure. We should probably eventually
remove this mechanism but for now we will undo just the latest block,
not the lest 6 blocks as that may be excessive and is sometimes slow for
BTC.
2026-04-22 12:17:58 -05:00
Calin Culianu
672b6b969a
Follow-up: Clean up formatting, comments, etc
Fixed some formatting, some comments, and a signed vs unsigned
comparison.
2026-04-22 12:17:13 -05:00
Calin Culianu
acd2685433 PeerMgr: Throttle new connections in process()
This fixes issue #324. We throttle the creation of new connections to max 10 per second, and
we also impose some additional logic on windows to pause the creation of new connections if
the windows object count exceeds 5000, or the active client connections in PeerMgr exceed 50.

For non-windows we just limit active client connections in PeerMgr to 200 before we pause.

This should avoid future unforeseen issues on all platforms, but definitely also fixes the
actual issue we have seen with Windows (issue #324).
2026-04-22 12:00:54 -05:00
Calin Culianu
86469b8eb4 Fix isWindows() returning the wrong result on Windows in Common.h 2026-04-22 10:46:18 -05:00
Calin Culianu
9e058c84cd
Nits: Add ability of CScript to push byte blobs from std::span
This can save on allocations in some cases, so we were able to simplify
BTC::Address class to us this new facility in CScript operator<<

Taken from BCHN MR !2023.
2026-02-23 23:24:50 -06:00
Calin Culianu
ccc98c342f
Minor nit/tweak to BTC::Address, toCScript()
Made the code more readable and also don't assume QByteArray::begin()
returns a pointer (it may not in some future Qt7 or something...).
2026-02-16 20:12:38 -06:00
Calin Culianu
a517cbcee9
Add RPC method: blockchain.address.get status & blockchain.scripthash.get_status (#316)
Added these methods as a way to query scripthash status without actually subscribing.

Requested by @mainnet-pat
2026-02-10 06:53:24 -06:00
Calin Culianu
cd513f65a0
Bump copyright year to 2026
Used a sed script to do it.
2026-02-09 10:55:22 -06:00
Calin Culianu
ff93ce5a69
Refresh the various servers.json files
Refresh them a little bit, deleting known-dead servers and adding a few
new active servers.
2025-11-19 10:24:57 +02:00
Calin Culianu
646adf4fb8
PeerMgr: Moved log message about retrying SSL port to happen later
And also made it be a Warning
2025-11-18 12:26:40 +02:00
Calin Culianu
cad2bc0e25
PeerMgr: Make good peer refresh interval 30 mins again
To preserve previous behavior. Every 10 mins was a bit too frequent.
Every 30 was what we did before, so we should just maintain the same
behavior.

Also in this commit: don't normal-level log the "Verified peer" message
if refreshing a known-good peer, instead put it in debug-level log.
2025-11-18 12:09:00 +02:00
Calin Culianu
4be5fc159e
PeerMgr: Added preferSsl key to stats map for PeerInfo object 2025-11-18 10:34:30 +02:00
Calin Culianu
f68413fc12
Tweaked a comment 2025-11-18 10:09:01 +02:00
Calin Culianu
33cd1362b0
PeerMgr: Tweaks to TCP fail -> SSL retry processing
Only do the SSL retry if it's clear we failed to connect to the port
either via "Connection refused" or via "timed out" (either of which can
happen if the port is closed, depending on router config on the remote
end).

Also: Tweaked the log message and also clear the preferSsl flag on full-on
failure to retry from scratch with TCP again in future.
2025-11-18 10:06:45 +02:00
Calin Culianu
79b493513d
PeerMgr: On connection failure to TCP port, retry SSL port (if any)
This helps us tolerate server misconfigurations where the TCP port is
invalid/not-working but the SSL port would work. e.keff.org on BTC
mainnet is one such server.

We prefer to be tolerant here to pick up as many "good" servers as
possible, in the interests of wallets obtaining as many options as
possible for servers.

This is ok to do and preferable since wallets almost exclusively use the
SSL port anyway.
2025-11-18 09:28:55 +02:00
Calin Culianu
427cbbd293
Bumped verison to 2.1.0
We may do a release soon due to added goodies (protocol 1.6, change to
peermgr, update to Qt6 for the static builds, etc).
2025-11-17 21:09:01 +02:00
Calin Culianu
a44c5237af
PeerMgr: Remove extra updateSoon() calls
These calls are no longer needed for when clients are created and
destroyed (as they once were). They were redundant and have been removed
to reduce potential extra update() calls running when nothing changed.
2025-11-17 17:50:39 +02:00
Calin Culianu
45ab30002a
Peer Manager: Don't keep "good" peer connections alive (#309)
* Peer Manager: Don't keep "good" peer connections alive

Closes #307.

All previous versions of Fulcrum would maintain active connections to
all "goor" peers forever, periodically refreshing them every ~30 mins.

However, on BTC with so many Electrum-style servers around, this could
end up eating ~200 or more connections just for peer discovery. Since
this is wasteful, we instead opt to simply disconnect after determining
that a peer is "good" and instead keep around a separate "good" list
(previously the "good list" was just the active PeerClient connections).

We re-connect to known-good peers every 10 mins to determine whether
they are still up and to pick up any changed ports, etc.

* PeerMgr: Log to debug number of active clients we delete on cleanup
2025-11-17 02:02:54 -06:00
Calin Culianu
057bacd552
Got rid of UNLIKELY/LIKELY macros in favor of C++20 [[likely]]/[[unlikelu]]
Also in this commit: Some small nits and 1 comment typo fixed
2025-11-05 22:44:56 +02:00
Calin Culianu
4a9f84c8fd
Make some fields in ServerMisc namespace constexpr
Also make Client::Info::protocolVersion default to the ServerMisc
minimum protocol version, rather than the magic number we used before,
so that things rely on minimum version in only 1 place in the code..
2025-11-05 09:34:01 +02:00
Calin Culianu
92f78d9a8d
Updated electrum-cash-protocol submodule pointer 2025-11-05 08:55:29 +02:00
Calin Culianu
56380f17dd
Merge pull request #305 from cculianu/protocol_1_6
Implement Protocol v1.6
2025-11-05 08:53:06 +02:00
Calin Culianu
7020f7a98d
Updated electrum-cash-protocol submodule 2025-11-05 08:51:18 +02:00
Calin Culianu
5e420e8434
Small refactor: Use IsMetaTypeStringLike in more places 2025-11-04 21:14:07 +02:00
Calin Culianu
4c8436e3e6
Tweaked the submitpackge missing warning 2025-11-04 20:53:58 +02:00
Calin Culianu
76b1ca4988
Added protocol 1.6 requirement: ignore extra args past 2 for server.version
They just end up in the ether but to do to debug log if debug logging is
enabled.
2025-11-04 20:49:21 +02:00
Calin Culianu
06b50dc695
Added startup warning about needing to upgrade node if on BTC and no submitpackage
Also in this commit:

- Updated README.md to talk about v1.6 protocol compatibility and need
  for v28.0.0 or above of Core/Knots
- Updated RPC error message saying Bitcoin Core or Bitcoin Knots (not
  just Bitcoin Core) >= v28.0.0 is ok for submitpackage.
2025-10-26 17:03:45 +02:00
Calin Culianu
b9c2aa766e
broadcast_package tweak: Make the log filter key be based off the last txn, not the first 2025-10-26 10:27:28 +02:00
Calin Culianu
c76b9a5897
Fix a compile error on gcc: explicit specialization in non-namespace scope 2025-10-26 09:43:41 +02:00
Calin Culianu
6ba09bfc41
Redid broadcast_package to do some work in an asynch thread
We validate args in an asynch thread since that is potentially costly
(we must hash the first txn, etc).

When that's done, we forward request to bitcoind.

This required us allowing generic_do_async to accept an optional
"completion" function. In order to make things cleaner and faster we
templatized ServerBase::generic_do_async, and redid its internals
slightly. Hopefully this is cleaner and also hopefully redundant copies
of e.g. std::function are avoided with this template implementation.

Also in this commit: Various nits and fixups in Util.h, added
ThrowInternalErrorIf() macro, and other misc. cleanup.
2025-10-26 09:35:01 +02:00
Calin Culianu
414549e942
Fix to broadcast_packege stats to only register success on full success 2025-10-25 19:07:36 +03:00
Calin Culianu
aef748e578
Nit in ThreadPool.cpp -- use std::unique_ptr
Paranoia just in case an exception is somehow thrown before we hand the
job off to the threadpool.
2025-10-25 00:20:23 +03:00
Calin Culianu
1082198f67
Don't use QVariantList.append() since it's ambiguous
And does the unexpected thing if appending a list to a list.. :/
2025-10-24 22:23:49 +03:00