17 Commits

Author SHA1 Message Date
tomFlowee b0c96e5b59 Cleanup after node got banned. 2026-05-18 13:34:20 +02:00
tomFlowee 519c76b149 Remove unused code 2026-05-15 09:19:57 +02:00
tomFlowee 0d410b17d8 Change tx validation to default to on. 2026-05-14 15:21:44 +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
tomFlowee b10f6ea2fb Merge UnspentOutputData classes
Two classes that were becoming very similar now are one.
2026-05-13 17:55:43 +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
tomFlowee 562eba5b64 Make outscript usage shallow
The new SIGHASH_UTXO has a possible attack vector where prepared huge
outputs are used and required to be hashed for the signing preimage.
At most you can force the full node to prepare 20GB of (utxo) data
_prior_ to creation of the preimage. Which is a big issue when it comes
to memory usage of the node.
What this change does is we ensure that the class used for this data is
a ConstBuf as given to us from the utxo. Which are just pointers and not
full data, the data is memory mapped.
So we ensure shallow copies to avoid actually requiring the data to be
in memory until the point where it is used. And it can get swapped out
immediately after.

This ensures we are immune to the SIGHASH_UTXO attack vector.
2026-05-12 15:46:48 +02:00
tomFlowee 03a0e2d891 Cleanups 2026-05-08 23:52:03 +02:00
John Galt 3bb2e22859 validation: enforce May 2023 tx size and version rules 2026-05-08 23:22:28 +02:00
tomFlowee b48aa63b58 Add booleans and block heights for upgrades. 2026-05-05 09:05:35 +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 d806b09729 Needs a max too. 2026-04-11 19:00:23 +02:00
tomFlowee 8c28e349b9 Tweak in the numbers. 2026-04-11 14:38:11 +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 e8aa7b5e0e Update transaction size check.
Get a little bit back into consensus.
2025-04-12 12:11:01 +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 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