Commit graph

23 commits

Author SHA1 Message Date
Calin Culianu
5cba060842
Small performance improvement for block processing
Added a map.reserve() call for an internal hash table used to map
txid -> txPos in PreProcessedBlock::fill. This reduces the number of
allocation during block processing slightly and should shave off a few
cycles per block processed.
2020-01-03 00:34:37 +02:00
Calin Culianu
a831cce8ac
Modified license preamble to say "Bitcoin Cash" instead of "Electron Cash"
The hope is maybe people will adopt this with other wallets...
2019-12-28 23:48:24 +02:00
Calin Culianu
405335c173
Added LICENSE preamble to all top-level source files
GPL v3. YAY!
2019-12-28 23:46:05 +02:00
Calin Culianu
e2b8e5af7e
Nits .. renamed a few data members to be clearer and added comments 2019-12-12 13:15:45 +02:00
Calin Culianu
b799dfb2a8
Scripthash history fix. Oops!
we weren't adding the right txidx to the history.  Good thing I also
added debug code to this commit to check history.

Fixed!

Also various other nits and tweaks.  Added the /debug endpoint for
sending params for debugging to the server.
2019-12-12 12:15:06 +02:00
Calin Culianu
4dbc8e1b7d
Added scripthash_history update during sync
Requires the "merge operator" for performance. This ends up requiring a
lib recompile to use RTTI.
2019-12-12 00:07:29 +02:00
Calin Culianu
004c31e456
forgot to specify initializer for OutPt's spentInputIdx optional 2019-12-11 19:58:52 +02:00
Calin Culianu
c1d01fb029
Reduced CPU usage in addBlock -- we mark outputs spent in PreProcessedBlock now
This reduces the building of a set for each hashX in addBlock. Now we
flag the outputs that are safe to ignore for adding to utxo set (because
they were already spent) by flagging the OutPt directly in
PreProcessedBlock fill().

Should improve performance slightly as no more nested loops in
addBlock()
2019-12-11 17:02:42 +02:00
Calin Culianu
f279e484b7 got rid of the ProcessedBlock stuff. The txNum optimization will be opaque to the rest of the app. Rest of app will deal in TxHash natively. 2019-12-07 15:04:45 +02:00
Calin Culianu
34e5e35a1c
Redid the hashXAggregated structure in BlockProc
It's now an unordered_node_map, keyed off of HashX.  This should be more
useful down the processing pipeline.  What we had before was confusing and
difficult to use.. its only advantage was it preserved order of HashX's
in a block.

We can reproduce the order though on-demand if it turns out we need it
by adding a method to construct an array keyed off the in/out index per
hashX.

So this map approach is sufficient and likely more useful.
2019-12-05 18:19:55 +02:00
Calin Culianu
082fb42af5
Switched to using robin_hood::unordered_flat_map
This is so much faster than unordered_map it's silly.  Also supposed to
use less memory. AND it's a single-header lib!  Very exciting.  W00.
2019-12-05 13:02:43 +02:00
Calin Culianu
409feb1994
Ok, fixed the utxoset bug
Turns out our custom HashX class was doing some funny things when a
HashX had a \0 byte.  Likely QByteArray isn't really intended to be
inherited from.  Rather than investigate what was going on -- I just
decided it's sufficient to do: using HashX = QByteArray and be done with
it.

Now our utxo set is working correctly.

We still need to figure out how to store everything.. but this is
progress.
2019-12-05 12:07:27 +02:00
Calin Culianu
bf5eebaa65 wip -- it's kinda broken still.. :( 2019-12-04 23:53:45 +02:00
Calin Culianu
0480633de8 massive refactorings 2019-12-04 20:02:14 +02:00
Calin Culianu
ea6a607642 wip 2019-12-04 16:54:40 +02:00
Calin Culianu
7f6d025be2 nit: made GetBlockHeaderSize() return int because that's more useful to us 2019-12-03 21:53:32 +02:00
Calin Culianu
48e5f116d8
More nits in Storage.cpp and other places 2019-12-03 19:09:38 +02:00
Calin Culianu
844fdf3d27
Tweaks: restrict prevouN and inputN to 16 bit uint
Tx's can't have more than 65535 inputs or outputs, so this is ok, and
should save a little bit of memory for block processing.
2019-12-03 07:20:32 +02:00
Calin Culianu
6b0fc4183a
nit 2019-12-02 19:03:46 +02:00
Calin Culianu
0556caf0f4 wip -- mostly works. task end has some spurious events that need removing but works well 2019-12-02 13:50:18 +02:00
Calin Culianu
4a68eaaeaa
nit 2019-12-02 10:00:22 +02:00
Calin Culianu
76d0505323
Nits, refactorings, and tweaks
Cleaned up the code for BlockProc and created the HashX class

Plus made some of the PreProcessedBlock fields be more type-safe (using
std::optional)
2019-12-02 01:29:24 +02:00
Calin Culianu
e9d3991ded
WIP - added PreProcessedBlock
The PreProcessedBlock is intended to be a somewhat munged/mogrified form
of a CBlock which is somewhat ready for a db insert.

This data will get passed onto the Controller thread which will set
everything up to commit the SH history, header, etc to the db.

Did some initial testing and it's pretty fast and also.. I think it's
correct (as in I'm collating the data correctly).

TODO: Some more testing.
2019-12-01 22:36:19 +02:00