Commit Graph

13024 Commits

Author SHA1 Message Date
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 66b047853d Cleanup unit test 2026-05-12 00:11:54 +02:00
tomFlowee 0aa874b621 Cleanups and fixes.
This fixes a surprising interaction of the utxo checks with the
script verify flag SCRIPT_VERIFY_STRICTENC.
2026-05-11 22:55:32 +02:00
John Galt d1f6296398 script: enable May 2023 SIGHASH_UTXOS 2026-05-09 23:52:30 +02:00
tomFlowee 3e0195509e make compile 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
tomFlowee 6c992b9fd1 Work around bug in old version of boost.
Modula by zero will make the CPU throw a signal at our process, as
such (just like divide by zero) we should detect it.
Boost does that just fine in newer versions, but we need to write
that line ourselves for older ones.
2026-05-09 23:52:30 +02:00
tomFlowee 34fbdd38f6 Remove unneeded line of code. 2026-05-09 23:52:30 +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 0c59b0a70f Add constructor test 2026-05-08 22:53:38 +02:00
tomFlowee 078544445f Add testset for big int.
Imported json from our friends over at bchn.
2026-05-08 22:16:46 +02:00
tomFlowee 764e9d166c Rename tests to be nicer. 2026-05-07 22:10:35 +02:00
tomFlowee a43372ceaa Avoid scary gcc warning
This would give a memcpy warning that is known to happen with boost
multiprecision but is ultimately
harmless.
2026-05-07 22:05:11 +02:00
tomFlowee 4a12e4885f Use new math in interpreter, regardless of flags.
This avoids overhead for a case that never happens.
2026-05-07 21:40:25 +02:00
tomFlowee f1012f0797 Move classes out of public ones.
script.h is installed and part of the library 'flowee_utils', as such
it makes sense to move those new classes out of the ones seen by
downstream users.
2026-05-07 21:12:56 +02:00
John Galt de512b9edb Import BigInt protocol upgrade 2026-05-07 17:51:05 +02:00
tomFlowee cd317bc3c0 Cleanup p2sh32
The activation is past and there is no point in having a flag passed
through a dozen methods in order to detect when to enable it.
Because it is always enabled.
2026-05-07 16:15:26 +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
John Galt 45b8369aaf add chipnet chain 2026-05-07 12:21:35 +02:00
tomFlowee e18d78d30e Remove include 2026-05-07 10:37:09 +02:00
tomFlowee 2a53899909 Print message before failing. 2026-05-05 09:05:35 +02:00
tomFlowee b48aa63b58 Add booleans and block heights for upgrades. 2026-05-05 09:05:35 +02:00
tomFlowee f53daa79f6 Cleanup
This removes the transaction-signing code from the hub internal codebase.
The only user for this was the API call signrawtransaction,
and a lot of unit testing code.
I'd argue that if the user needs to send a private key to the hub via
RPC for signing his transaction, then they are doing it wrong.

This also removes the duplicate test double_spend which tests
functionality also tested in the DoubleSpendProofTest.

As an aside, the flowee/utils library still has full signing capability
and we suggest using the TransactionBuilder API for that.
2026-05-05 00:39:16 +02:00
John Galt d6c9886071 Avoid incorrectly detecting an error
This checks only the data inside of the leaf.
2026-05-04 21:48:45 +02:00
tomFlowee aa7f639e79 Fix assert and add comment. 2026-05-04 21:32:08 +02:00
tomFlowee 37f6039898 Remove unused include 2026-05-04 21:32:08 +02:00
tomFlowee 648f348c3a Apply best header to the header tip
This uses the header longest chain if that is longer than the fully
validated chain.
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
John Galt f1067b0744 NWM: prioritize pong replies under queue pressure
Rationale: pong responses should use the priority queue so they
are not stranded behind normal-backlog traffic.
2026-05-04 19:13:17 +02:00
tomFlowee 5bd01e0752 Fix threading issues
The binds to the executor now use the strand for more callbacks and
avoid race conditions that way.
2026-05-04 17:11:16 +02:00
tomFlowee bb36475f45 Avoid calls to throwing methods. 2026-05-04 15:45:46 +02:00
tomFlowee 69d4c03e48 Use shared from this, instead of 'this' in callbacks.
Defensive programming, really.
2026-05-04 15:29:24 +02:00
tomFlowee d71aeb7b40 Add support for p2sh32 2026-04-22 17:01:26 +02:00
tomFlowee d819e0fa4c Make p2sh address extraction work.
This now uses the proper prefix/postfix to detect a p2sh.
2026-04-22 13:28:53 +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 a1ccedb592 new version 2026-04-20 22:59:58 +02:00
tomFlowee c3e2f98b75 Remove expensive and not used ToString() methods.
The mining code still called that, this replaces it with standard
log lines that cost less at runtime and keeps the code that is
rarely run away from the shared parts.
2026-04-20 22:45:56 +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 5e8ff4b718 Fix buffer size. 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 6cf5cdb8c3 Use unique test names. 2026-04-15 20:58:20 +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 03ec8f65aa minor textual changes 2026-04-15 00:07:09 +02:00
tomFlowee d7b46c7cea Update numbers to 2026 2026-04-15 00:07:09 +02:00
tomFlowee 900e790bf0 Avoid warning: make more =default. 2026-04-15 00:07:09 +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 ff4a433173 Remove dead code. 2026-04-15 00:07:09 +02:00