Commit Graph

17 Commits

Author SHA1 Message Date
TomZ e9a2437c2d Add unit tests for UTXO and fixes
This fixes that the .info file is sometimes not written when nothing
changed in the db file.

This fixes that the info file with .1.info extension is reused again
and again, effectively reducing the usefulness of the snapshots.
This only really affects the indexer as pruning avoids this most
of the time.

Closes issue flowee-issues#6
2020-05-18 22:51:41 +02:00
TomZ f7f4ea0093 make testing/streaming not link to flowee_server
Also split the testlib into two static libraries and avoid
recompile of the base test file in each test that used it.
2019-12-30 17:55:48 +01:00
TomZ 175096b2bd Refactor: move files
Move some files back to the server "library".
Merge the 'console' lib with server, as it doesn't really make sense with
just one file and nobody exclusively linking to it.

The server "libary" is not really a library, its the place we put all
the files shared by hub-qt hub-cli and hub.
We no longer depend on these files from other places (mostly due to
moving to the new logging framework) and as such we can move the files
back.
2019-11-13 19:09:24 +01:00
TomZ 2bb06afa9e Cleanup the link-lines 2019-08-24 22:25:09 +02:00
TomZ a09339dc05 Applying lessons learned for lock-free programming
The reason there are no standard library versions of lock-free
containers is because you want to always take full advantage of
the details in question.
In this case (read millions of times for each modification) it makes
no sense to use anything other than a standard container, but put in
a copy-on-write block. Simple and easy.
2019-03-05 18:52:49 +01:00
TomZ 31650b7340 Squashed commit of the utxo-lockfree-map branch
Replace the m_buckets unsorted map with a lock-free version
based on atomic pointers. (BucketMap)
remove the m_leafs and move those into the bucket struct.
Make the access to the jumptable transactional to avoid one big lock
over all datastructures.

On my threadripper 2990WX the entire 150GB BCH blockchain was
parsed and imported in under 3 hours.
2019-02-23 15:33:22 +01:00
TomZ 82d2651d4f Fix copy/paste error and add some more sanity checks
Also fix insert() usage in unit test to not hit that new assert
2018-10-13 21:33:17 +02:00
TomZ 13c2a64f56 Identify another usecase of utxo rollback and fix
Including unit test
2018-09-20 21:55:07 +02:00
TomZ 82a670787e Merge branch 'master' into UnspentOutputDB
Conflicts:
	testing/prevector/test_prevector.cpp
	testing/test/test_bitcoin.cpp
	testing/utxo/test_utxo.cpp
2018-08-15 20:30:45 +02:00
TomZ 7df238b281 Refactor tests a little
Duplicate the test_bitcoin file into the common dir,
I hope to remove the original in future.
Make the common dir a new static lib and create a new
qtestlib based unit test out of the old doublespend unit test.
2018-08-14 22:44:00 +02:00
TomZ a982b6b3b4 Avoid duplication 2018-08-14 17:00:29 +02:00
TomZ 98d58df63d Move utxo tests over to be qtestlib too 2018-08-14 15:53:00 +02:00
TomZ d58352080e Add another UODB rollback unit test and fix 2018-08-04 17:28:08 +02:00
TomZ 0bfa3cbb85 Introduce rollback() on UnspentOutputDB
together with blockFinished() as 'commit' this introduces the ability
to modify the in-memory utxo which can be rolled-back with ease.

This allows us to "modify" the utxo while validating a block in an
optimistic manner and only spend extra resources doing a rollback
should the block end up not being Ok.
2018-07-29 18:03:49 +02:00
TomZ 1600086ede Updates to and start using the UnspentOutputDB
The new UnspentOutputDatabase classes are only very loosly a database, we
purely register and store unspent outputs there. But unline a DB we don't
allow modification (just insert and delete).

This replaces the coin-db (which was based on leveldb) and as first goal
this gives us a higher level of stability. The level-database was known
to give corruption issues.

Notice that users will need to do a manual reindex on first update.
2018-07-23 19:49:32 +02:00
TomZ e13730a042 Make backwards compatible 2018-06-24 13:01:39 +02:00
TomZ c368c6ef77 Create new UTXO database library
The old was based on levelDB which has scalability issues and stability
issues. (most often cited problem is corrupted database..)

This unspent output database I wrote is based on the idea that we need
never actually update any rows, which makes most old fashioned databases
a bad fit.
All we do is create rows and we forget rows. So lets design a DB to fit
that pattern.
2018-05-09 10:48:16 +02:00