38 Commits

Author SHA1 Message Date
tomFlowee b0c96e5b59 Cleanup after node got banned. 2026-05-18 13:34:20 +02:00
tomFlowee 0572486278 Move flag detection to before usage
As flags (like an upgrade being active) have been added in the codepath of
checks2 (contextualChecks), we need to make sure that we update the flags
to the current block just before we do that. So move this one up.
2026-05-15 09:19:57 +02:00
tomFlowee 519c76b149 Remove unused code 2026-05-15 09:19:57 +02:00
tomFlowee 6838d03e57 Fix op-mul activation 2026-05-15 00:03:09 +02:00
tomFlowee 7bb20aa818 Rename method to fix typo 2026-05-14 23:31:17 +02:00
John Galt 4f77768864 validation: activate May 2025 and 2026 script flags 2026-05-14 20:19:07 +02:00
tomFlowee aa97cb2f3c Make logic cleaner. 2026-05-14 15:21:25 +02:00
tomFlowee 5451d1431b Make sure we have access to Tx
The MutableTransaction is only for creation,
the CTransaction is basically only there for backwards compatibility and
is kind of half deprecated.
The Tx class is to be used for all new code in validation.

The reason for this is because the CTransaction and friends are terribly
expensive to create and they have horrible effects on multi-threaded
validation.

So, to help this concept along we now pass both the old and the new tx
to a method that has not been ported to use the new yet. This at
least makes available the new Tx instance so when new code is written
it is easier to do the right thing (tm).
2026-05-14 13:27:17 +02:00
John Galt ad730f4d34 script: add CashToken introspection opcodes 2026-05-14 10:28:44 +02:00
John Galt 6f4c85570a primitives: fix indexed output lookup 2026-05-14 10:28:44 +02:00
tomFlowee b10f6ea2fb Merge UnspentOutputData classes
Two classes that were becoming very similar now are one.
2026-05-13 17:55:43 +02:00
tomFlowee 6996e56330 Cleanup includes 2026-05-13 17:55:03 +02:00
tomFlowee ced4f98beb Add token support to the Tx object
We add a Token class to Tx, which adds an easy to use API when compared
to the plain iterator. The main point of the API chosen is to make sure
we don't do unneeded parsing or copying for tokens unless needed.

Additionally refactor the ValidationPrivate::UnspentOutput class to
inherit from the Tx::Output class in order to avoid lots of duplicated
logic on handling the data.
2026-05-13 17:20:32 +02:00
John Galt d1f6296398 script: enable May 2023 SIGHASH_UTXOS 2026-05-09 23:52:30 +02:00
John Galt e2ad620969 script: enable May 2022 native introspection opcodes 2026-05-09 23:52:30 +02:00
John Galt 3bb2e22859 validation: enforce May 2023 tx size and version rules 2026-05-08 23:22:28 +02:00
John Galt 96f036e78d script: enable Upgrade9 P2SH32 validation
Adds the SCRIPT_ENABLE_P2SH_32 script flag and applies it at the existing May 2023 activation point
2026-05-07 15:29:55 +02:00
tomFlowee b48aa63b58 Add booleans and block heights for upgrades. 2026-05-05 09:05:35 +02:00
tomFlowee 37f6039898 Remove unused include 2026-05-04 21:32:08 +02:00
John Galt 26ee594ef5 validation: rescan live full-block arrivals 2026-05-04 21:31:35 +02:00
tomFlowee 25b91d9a48 Make this into a simple for loop
The usage of std::equal is tricky due to the lack of length
variable. This avoids any off-by-one issues.
2026-04-21 00:39:52 +02:00
tomFlowee 7db4a84bc3 Fix the way that orphan flushing is done.
Also use a faster container for fetching orphans.
2026-04-20 22:21:18 +02:00
tomFlowee f3dc67d3e1 Make faster. 2026-04-20 22:21:18 +02:00
tomFlowee 0a2e552168 Move more logic over to byte-array based Block
This introduces a new BlockHeader helper class which Block and
MutableBlock can both produce, which helps a lot of methods to
be ported to no longer be dependent on us using a MutableBlock
object, which is too costly to use when we have no intention
to alter the block.
2026-04-20 22:21:18 +02:00
tomFlowee 6cb1f97700 Move checking for space to the proper place. 2026-04-15 14:16:33 +02:00
tomFlowee 9aa590cc62 Fix rare benchmark measurement issue. 2026-04-15 14:15:57 +02:00
tomFlowee 25f9e6979c Changes to use the new format
For transaction::checkTransaction():
this in practice avoids lots of mallocs and overhead while doing
transaction checks.

For merkleroot, the same benefits. Avoiding copying and mallocs.
2026-04-15 00:07:09 +02:00
tomFlowee 9103051683 Minor logging updates. 2026-04-11 14:38:33 +02:00
tomFlowee f44007d86d Add bool on engine: do SPV level validation only
This helps unit tests.
2026-04-09 23:15:08 +02:00
tomFlowee 07f408d601 Turn off validation while not in consensus. 2025-04-12 12:14:59 +02:00
tomFlowee e8aa7b5e0e Update transaction size check.
Get a little bit back into consensus.
2025-04-12 12:11:01 +02:00
tomFlowee 1dc2656bef Follow ASIO porting for apps too. 2025-02-11 19:41:22 +01:00
tomFlowee bb7275466b Stop using deprecated asio io_service
This ports the io-service to the source compatible io-context
class, with the most work going to the WorkerThreads which owns
that one.
2025-02-08 19:05:26 +01:00
John Galt c532227b5c Make this code aware of the new tx anatomy
Transactions can have token information before the output-script,
as such we add the filter and only go for the data we actually want.

This code is written by Telegram user @John_Galts_Gulch.
2024-09-01 21:51:18 +02:00
tomFlowee 517a90abeb Detect too many orphans
If for some reason there are a massive amount of orphaned headers, we
don't just keep them around until they are resolved as that is
detrimental to the operation of the node.

Special case this for a reindex and simply skip all orphans fur the
duration.
2024-03-20 19:11:58 +01:00
tomFlowee bc47a700a4 Refactor; wrap BufferPool in shared_ptr
As we moved most of the creation of a BufferPool to be via the
Streaming::pool() method, which uses a thread-local, it makes sense
to start cleaning up the design and make it more modern C++.
The above mentioned method would return a reference and you'd see
loads of places use `auto &pool =` which is less than ideal.

As the number of places where we actually instantiate a BufferPool
goes down, the usage of some sort of smart pointer makes more sense.

This now makes all APIs use BufferPool be wrapped in a shared_ptr.
2023-12-21 15:23:23 +01:00
tomFlowee ebaccb6fee Move include to cpp file 2023-07-15 11:36:19 +02:00
tomFlowee b4a3da2642 The 'Server' and 'Api' dirs are not libs
These are technically static libs, but not in any way shared libs.
They are used solely only by this repo and really only by the hub.

Most important, no header files are installed and basically none of
the normal rules for reusable libraries are applied to these files.
2022-02-22 18:39:13 +01:00