Commit Graph

248 Commits

Author SHA1 Message Date
tomFlowee 919d6ffbc5 Make test less fragile.
This avoids depending on Qt CoW not hitting on returning it.
Also fix open() in release builds.
2021-08-09 21:26:07 +02:00
tomFlowee ae78dd0bb8 Update email address 2021-06-20 22:44:44 +02:00
tomFlowee 460d4be807 Add new method Blockchain::blockHeightAtTime() 2021-05-28 14:52:27 +02:00
tomFlowee d1fa3fa4a9 [P2P] Allow static loading of blockheaders
This adds a unit test for the Blockchain class in the p2p lib and this
introduces the functionality to have a blockchain pre-shipped with an
app.
2021-05-27 19:08:46 +02:00
tomFlowee f9a0050220 Update TransactionBuilder / signature type handling
The choice between Schnorr and ECDSA signatures is now per input instead
of once choice for the entire transaction.
2021-05-04 16:57:55 +02:00
tomFlowee 76fde4a94c Make the test go back to ECDSA style signatures. 2021-04-19 17:07:02 +02:00
tomFlowee c58586516d Allow for longer mock-chains of blocks.
In RegTest we have a much shorter cycle of halving, take this into
account when building blocks.
2021-04-19 17:06:15 +02:00
tomFlowee f163e942a7 Add Schnorr unit tests 2021-04-19 16:28:54 +02:00
tomFlowee 6682a4a5b2 Rename CKey::Sign() -> signECDSA() 2021-04-19 15:45:02 +02:00
tomFlowee fcb648916d Make pubkey follow coding styleguide 2021-04-19 14:48:18 +02:00
tomFlowee 178bdf8b74 Add new unit test
This test tests the new Mining::SubmitBlock feature.
We also test the GetBlock with the new FilterOnScriptType feature.

Some new helper methods in the messageBuilder and FastBlock are also
used and tested.
2021-03-24 21:00:26 +01:00
tomFlowee 0a1f0f8c52 Split 'API' tests into separate executables.
The test starts to become long to run and using the one main.cpp
hack we had removes our ability to select one test to run, so lets
go back to one executable per class.
2021-03-24 19:08:25 +01:00
tomFlowee 9d6ba33cc0 Add and test service to receive all double spend proofs. 2021-03-18 11:07:50 +01:00
tomFlowee d15a89dc99 Avoid duplication 2021-03-17 21:07:25 +01:00
tomFlowee 7406cd6ecf Remove dead code (xor of stream). 2021-03-16 19:34:33 +01:00
tomFlowee 45dd785f39 Follow whole-script sizelimit.
Also add unit test for the op_return limits.
2021-03-13 16:52:04 +01:00
tomFlowee a9d3c2ee92 Support change to allow multiple op_returns 2021-03-13 14:02:38 +01:00
tomFlowee a7fd89c360 Make sure we record the lack of fee info. 2021-03-10 20:11:04 +01:00
tomFlowee 376a4ef9b5 Make block validation create a block metadata object.
This also changes the raw pointers to unique pointers for undo data.
2021-03-10 20:11:04 +01:00
tomFlowee 2395764bde Start new class BlockMetaData 2021-03-10 20:11:04 +01:00
tomFlowee 018a855e03 Avoid confusion.
People all over the Internet, including on the BCH spec, seem confused
about these enum values. They think they are opcodes.
So lets be clear and rename them to the thing they are. Placeholders or
a return-code.
2021-03-06 14:50:40 +01:00
tomFlowee c114c9dc74 Add an extra unit test. Tests CBlockIndex 2021-02-19 13:43:56 +01:00
tomFlowee 29082a1066 Follow coding guide; lowercase method names 2021-02-19 13:43:56 +01:00
tomFlowee ddfae7ed76 Add block-height fuzzing 2021-02-16 19:30:11 +01:00
tomFlowee f22b65e93e Fix test-instability
Avoid tests failing due to timing issues.
2021-02-16 19:13:05 +01:00
tomFlowee 58d7c3b4fb Add fuzzing test for transaction fetching.
This test just requests a transaction for each offset in block in
sequence, meaning that our question is incorrect most of the time.
2021-02-16 19:03:44 +01:00
tomFlowee efa23bd2db Extend Live::GetTransaction to search on address too
This allows API users to search the mempool on address or on txid.

This also adds a new unit test testing this functionality
2021-02-11 15:21:54 +01:00
tomFlowee 94ae61132b Promote 'interpreter' to the utils lib.
Being able to parse bitcoin-script is useful for users other than
the hub, using the flowee shared libraries they can now do so.
2021-01-21 15:47:46 +01:00
tomFlowee 7b0949031f Rename CHashWriter::GetHash to finalizeHash()
as the expected behavior of 'get*' is a const method, it is harmful to
name a method such when it actually alters the state of the method such
that subsequent calls will produce a different result.
2021-01-20 22:51:48 +01:00
tomFlowee 235df9c5f0 Add loading of DSProof from a constbuffer. 2021-01-20 21:35:20 +01:00
tomFlowee defd3950f0 Remove CAmount typedef
The CAmount name is not helpful as its just an int64_t and not a
class, like the name implies. There were a handful of places where
it was passed in as const-ref, as a good example of this actually
creating sub-par code.
2021-01-20 19:59:35 +01:00
tomFlowee 30e28acdd5 Remove unused code.
Move the MutableTransactionSignatureChecker class out of the header and
thereby remove the need to include transaction.h in the header.

This checker was never used in any app, just in the unit tests.

This also fixes includes around.
2021-01-20 18:22:34 +01:00
tomFlowee b836134081 Fix a source of test instability
Especially seen in the block-validation tests, we sometimes delete
the validation engine while some other threads are still doing stuff
with the not surprising effect that we may cause crashes or asserts
to get hit.

This change makes us wait instead.
2021-01-20 15:59:45 +01:00
tomFlowee 407dd2f2ab Simplify messageparser.
Remove some unused methods and complexity.
2021-01-06 19:37:27 +01:00
tomFlowee 3fe98afce9 Minor cleanup
This removes some unused includes from common headers and dead code
from some C++ files.
2021-01-05 22:05:25 +01:00
tomFlowee 3299795fc2 Add test for GetMempoolInfo 2020-12-24 22:45:21 +01:00
tomFlowee 63aebe14a1 minor fixlets 2020-12-24 14:15:48 +01:00
tomFlowee 56ea5579f1 BlackboxTest: printing of debug lines
Reuse the feature of TestBasic to make the logger prefix the test
function we are currently in.
2020-12-24 12:54:04 +01:00
tomFlowee afce2134fd Fix include 2020-12-24 12:52:48 +01:00
tomFlowee edc255d308 Fix test
This test hardcoded a date now a couple of days in the past, which
made the test fail.

Set the date to be far in the future.
2020-12-17 10:42:15 +01:00
tomFlowee ba5689a4f4 fix BIP37 processing for non-topologically ordered blocks
Summary:
CMerkleBlock::CMerkleBlock called IsRelevantAndUpdate() on each transaction
in order, which (due to the outpoint-adding feature) assumes a topological
order of transactions in order to work correctly. If an outpoint of
interest were created later in a block than when gets spent, then it would
be added into the bloom filter too late, and thus that spending transaction
would get missed.

This changes CMerkleBlock::CMerkleBlock to scan all outputs first, then
make a second loop to scan all inputs. This requires breaking up the
IsRelevantAndUpdate() function into two parts. The original
IsRelevantAndUpdate() functionality remains fully intact however, as it
gets called from mempool-related code (mempool has topological order) and
tests.

Note that vMatchedTxn.push_back is moved into the second loop so that index
i keeps ascending order, in case that is somehow relevant. (the tests at
least do check this)

A two-loop construction like this will very slightly increase the false
positive rate.

Originally by: Mark Lundeberg
2020-12-17 09:49:15 +01:00
TomZ 27e507cba0 Test and fix reconsiderBlock
This adds a unit test to see if the combination of invalidateBlock and
reconsiderBlock do what we expect to do.

The main issue was that we store an invalidated block in the UTXO and we
forgot to re-validate that on reconsider.

Additionally I avoid writing a lot of unchanged data to the block-index.
2020-11-18 22:08:00 +01:00
TomZ bac18862c5 Add build dependency for testing 2020-11-17 21:46:39 +01:00
TomZ 477a536e25 [UTXO] UnitTest rollback-to-checkpoint code 2020-11-17 20:57:32 +01:00
TomZ dad1a0e0c0 Hardcode blockheight for DAA PU
Now the protocol upgrade went smooth, we take the effective details
and hardcode the blockheight for each chain we support.
2020-11-16 15:32:28 +01:00
TomZ e58a10fb6d Forgot the copyright license... 2020-11-10 18:48:03 +01:00
TomZ a966ffb129 Remove the hardcoded max message size.
We already had in place the blockSizeAcceptLimit as the limit
on messages, which is now the only limit.

In practice this means when the operator sets the maximum mining
size that we adjust the blockSizeAcceptLimit, if they only set the
blockSizeAcceptLimit, we use that (plus a margin) to limit messages
both on the p2p layer and on the RPC (JSON) layer we change the
limit to be twice the blockSizeAcceptLimit (copied those numbers
from BCHN).
2020-11-10 18:33:07 +01:00
TomZ a4800171b5 remove commented out code 2020-10-23 23:05:37 +02:00
TomZ 54329bf9e4 Add new DSP test to check for stupid usage :) 2020-09-30 10:27:51 +02:00
TomZ 14a938d54c Add speed test
To make sure that a pair of really large transactions being used
to create a DSP doesn't cause a blocking thread, this runs a
benchmark on a pair of transactions with 300 inputs each, causing
45k comparisons to be made.
On my laptop this results in 0.6 msecs for this creation of the DSP.
2020-09-29 20:35:41 +02:00