Commit graph

32 commits

Author SHA1 Message Date
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
baae6dea7b
Made BitcoinDMgr::submitRequest slightly more efficient 2019-12-18 23:16:49 +02:00
Calin Culianu
5b801d3e7e
nit 2019-12-18 20:40:34 +02:00
Calin Culianu
be446a6d84
Fixed race conditions in BitcoindDMgr::submitRequest
We cleaned up the code a good bit.  It's much clearer what's going on
and no funny business now.  No race conditions!  We leverage Qt's atomic
signal/slot disconnects on object destruction to manage everything for
us.
2019-12-18 20:38:09 +02:00
Calin Culianu
0dc106a26c
added a comment 2019-12-18 18:39:22 +02:00
Calin Culianu
bea420355b wip 2019-11-30 12:29:32 +02:00
Calin Culianu
e9d432f5e7
C++ template magic - newTask factory function
Templates are fun.  Decided to reduce boilerplate by making task
creation inside the Controller class be done by a template member
function which acts like a task factory.  It surrounds the construction
of the task with some boilerplate (namely, inserting the task in the
tasks map, connecting an optional errored signal, and starting the
task).
2019-11-27 20:32:50 +02:00
Calin Culianu
6df916565a
Made app only start listening for client connections after initial sync
Also in this commit various nits and subtle bugs prevented.

Refactored the 'Stats' mechanism to return a generic QVariant rather
than QVariantMap, which is more flexible.

Misc. other nits.
2019-11-27 14:07:09 +02:00
Calin Culianu
7fa213e095
Added "bitcoind is warming up..." messaging
Just a small nit, really.
2019-11-24 18:23:34 +02:00
Calin Culianu
9cd85765bd
nit 2019-11-20 10:42:14 +02:00
Calin Culianu
7368a0b0c1
some nits in BitcoinDMgr::submitRequest 2019-11-20 10:26:31 +02:00
Calin Culianu
b823f97397
nits 2019-11-19 12:33:50 +02:00
Calin Culianu
4b59e2233a Increased parallelism for the header sync
Set maxcur to 16, spinning up 3 bitcoind threads.

Seems to have brought header synch down from 170s to 71s on my mainnet
node here locally. Not bad!

Also fixed a bug where selecting bitcoind nodes was failing if >2 nodes.
2019-11-19 01:58:30 +02:00
Calin Culianu
2d0ea59c5a
hopefully some speed improvements to networking code 2019-11-19 01:10:45 +02:00
Calin Culianu
9213459817 wip 2019-11-18 21:09:21 +02:00
Calin Culianu
f4091bb005
Devised a scheme for asynch messaging to bitcoind
And added some test code in Controller to use the scheme.

It's very asynchronous.  Needs some tuning long term to see how it deals
with load and perhaps throttle the requests if we know bitcoind is under
load.

But for right now, for testing, it should work ok.

Also in this commit small nits, plus bugfix to RPC::Message factory
methods (I forgot to populate some instance properties when constructing
the objects).

Additionally, we were registering the qMetaType wrong for RPC::Message
and RPC::Message::Id (this has been fixed).
2019-11-18 14:32:48 +02:00
Calin Culianu
0b6d6f0b70
Initial detection of bitcoinDs going up/down for Controller
Playing with lambdas. Detects when bitcoind goes down. Initial code --
can put hooks in the detection for eg. stopping block processing or
starting it, etc.
2019-11-18 09:47:18 +02:00
Calin Culianu
45e12158db
Added process function to controller, and hooks for bitcoind when ready
Also added the "Fatal" logging class which logs as Error but then
schedules an app exit when invoked.  Only to be used for truly terrible
errors.
2019-11-18 08:29:33 +02:00
Calin Culianu
c0ea7f75a0
Refactored things, added "Controller" class
Controller will manage BitcoinD and perhaps synching to bitcoind. It can
"see" all the servers as well as bitcoind.

Also refactored things a little bit and added some more startup sanity
checks.
2019-11-18 00:21:34 +02:00
Calin Culianu
9e07f32e95
Added more stats 2019-11-17 12:38:36 +02:00
Calin Culianu
3c52e988dd
Fixed the dreaded virtual QObject *qobj() thing we had in this codebase
Finally, after 20 years, I figured out how to do this.  Diamond-patter
multiple inheritence is tricky. Downcasting from a Base to a Derived
must be unambiguous, for one (thus you need virtual when inheriting the
base).

Secondly -- it must all be public all the way down to the concrete
class!

This is subtle.  I suppose the Base cannot see the Derived class
inherits it per C++ rules if not publicly inherited.  TIL.

https://en.cppreference.com/w/cpp/language/dynamic_cast#Explanation
2019-11-17 10:31:40 +02:00
Calin Culianu
ca9db3fc8d
Refactored stats stuff into a mixin class, StatsMixin
This makes it so that subobjects that return stats get the "statsSafe()"
function for free (which does a Util::LambdaOnObject).
2019-11-17 00:18:44 +02:00
Calin Culianu
dc8d95ee69
Refactoring; made all AbstractConnection inherit TimersByNameMixin
Also wrote a virtual methd 'getStats()' for AbstractConnection which
puts some basic stats into a QVariantMap for the /stats endpoint.

Subclasses can call the base implementation and add their own stats to
the returned map.

Also in this commit: misc refactoring and nits
2019-11-16 22:28:27 +02:00
Calin Culianu
cffb8e86ca added the authenticated signal to the bitcoind class 2019-11-16 20:17:18 +02:00
Calin Culianu
1837e6123a
nit 2019-11-13 01:55:55 +02:00
Calin Culianu
7a00bb94fb
Added some preliminary skeleton of message processing
Still not sure how I will design this..
2019-11-13 01:52:15 +02:00
Calin Culianu
ec046c818d
Added more temp. /stats for bitcoind instances 2019-11-13 01:23:20 +02:00
Calin Culianu
7d1ee5d6de
Finally got to the bottom of the "didn't call on_finished" bug
Basically it's not called on app exit. We made it so it's not so crucial
it be called for cleanup.

Also added some preliminary stats to the http /stats endpoint for the
BitcoinD instances.
2019-11-13 00:57:20 +02:00
Calin Culianu
d59e1ff078
nits 2019-11-12 23:19:46 +02:00
Calin Culianu
7ae3b7e4b7
BitcoinD class to use the TimersByName mechanism 2019-11-12 22:42:16 +02:00
Calin Culianu
a34585da1b
Added BitcoinD classes.. lord help me.
Also "upgraded" the universal ID we use for all objects to use quint64
(unsigned) rather than signed, and the "NO_ID" is 0.
2019-11-12 22:14:04 +02:00