Commit graph

47 commits

Author SHA1 Message Date
Calin Culianu
7b4514b412
Made poll interval be 2 seconds
Also got rid of some of the debug log spam for GetChainInfoTask and
SynchMempoolTask -- they only print stuff if new stuff is found.

misc other nits.
2019-12-29 00:45:09 +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
20da1f0c8b
Misc odds and ends
Added license to project, and other goodies. Added -T option for poll
timer. Misc other things added.
2019-12-28 23:26:16 +02:00
Calin Culianu
7f2581ba6a
Oops... arg parsing broke
Fixed.
2019-12-24 17:10:01 +02:00
Calin Culianu
090bd16ee7
Initial try at SSL support. Works.. mostly.
Not sure about the cert/key situation.  Seemed fragile on macos.
Hopefully windows works without too much library static linking
insanity.
2019-12-24 16:49:47 +02:00
Calin Culianu
e275767a7b
DB changes, phase 1. Added 'dirty' flag, added utxoct to meta table, ...
We skip the utxo count check at startup unless the new -C (--checkdb)
flag is set, in which case we do a very thorough check of all utxos and
the corresponding scripthash_unspent entries.

We set a dirty flag during block addition / removal and if it's set, we
abort the app immediately and ask the user to do a full resynch.

Since adding/removing blocks isn't 100% ACID, this is needed until we
figure out how to redo the data to make everything ACID.

Also in this commit -- attempted to see if I could make the header
reading faster from the db by using MultiGet.  It turns out it doesn't
help much.
2019-12-22 10:55:24 +02:00
Calin Culianu
15d53f1760
Added Util::ThreadPool::SubmitWork mechanism
This allows for an app-global threadpool to be used for work that may
take a little while to complete.  The intended code that will use this
is the rpc server which will submit work that takes some time to
complete to the ThreadPool, so that the server's thread doesn't block
for very long while servicing client requests.

This ensures that the server remains responsive even if 1 or 2 clients
are issuing costly requests.

We plan on using this for get_history, listunspent, and the
merkle-related functions, to name a few.
2019-12-21 13:24:53 +02:00
Calin Culianu
1c89f60e12
Got scripthash_unspent working .. but block synch is painfully slow
We deleted the non-working merge operator for scripthash_unspent.. and
we do a read-modify-write for each new utxo/spend per scripthash.

It's very slow though.

I may have to defer updating this table until the very end from the utxo
set or something.  This is unacceptably bad...
2019-12-13 00:14:09 +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
608ba22231
added stats for merge calls for debugging 2019-12-12 00:23:19 +02:00
Calin Culianu
bd583bf18b
added code to test concurrent read of recordfile on windows especially 2019-12-11 12:02:41 +02:00
Calin Culianu
01f1ebd62c
Got rid of in-memory utxo set.. will rely on db
RocksDB is super fast. Keeping it in memory was a waste of memory.  This
is much faster and reduced memory consumption significantly.

TODO: Maybe do the same thing for headers as well!

Also: We need to save txNum to DB. We're not saving it now resulting in
correctness errors on subsequent reloads of same db.
2019-12-09 12:10:59 +02:00
Calin Culianu
8b7753fbdf nit 2019-11-29 17:24:16 +02:00
Calin Culianu
c38b7cf5ea
Added --datadir (-D) command-line option
Also added optional RPCUSER and RPCPASSWORD env vars that replace -u and
-p options more securely.
2019-11-28 23:58:24 +02:00
Calin Culianu
b2354111a0
Added print of banner to log every hour 2019-11-27 19:11:57 +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
31a1ec73f8
moved call to register metatypes asap at App init 2019-11-18 15:10:42 +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
5e9b659f81
some nits 2019-11-17 11:10:41 +02:00
Calin Culianu
04c4d5d5b7
Squashed commit of the following:
commit 326de9f8e9670ace95d6044e4f2d36a697a78ef9
Author: Calin Culianu <calin.culianu@gmail.com>
Date:   Wed Nov 13 11:27:23 2019 +0200

    fix apple compiler check

commit f794b3df1dda0c8b7df3c587688b8182a0de029d
Author: Calin Culianu <calin.culianu@gmail.com>
Date:   Wed Nov 13 11:12:01 2019 +0200

    added guard for msc_ver which doesn't support #warning

commit 04fbc36bbb40cbcc926e504f2109d766d2335113
Author: Calin Culianu <calin.culianu@gmail.com>
Date:   Wed Nov 13 11:06:12 2019 +0200

    Fix for win32-g++ compilation

commit a79b38b13da03ae741d81ca5a1a7978f9c09d961
Author: Calin Culianu <calin.culianu@gmail.com>
Date:   Wed Nov 13 10:49:33 2019 +0200

    Beat project into sunmission to compile on Linux using clang
2019-11-13 11:32:52 +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
Calin Culianu
0d0f41c2f5
Changed the way timestamps are printed in the log 2019-11-11 11:55:10 +02:00
Calin Culianu
b2b2509f25
Got HttpConnection working and talking to bitcoind
It works!  I still haven't figured out how to provoke the dreaded
"Workdepth exceeded" error .. but we pretty much drop the connection
anyway on anything too unexpected from bitcoind.

When the bitcoind manager class is written it will back off and try
again if too many disconnects happen.

For now though, the code we have is fast and works well against
bitcoind.
2019-11-11 00:22:31 +02:00
Calin Culianu
45daaf6e91
some nits 2019-11-09 21:14:07 +02:00
Calin Culianu
cd643e7323
Made Message::Id type a std::variant
I restricted the possible underlying types it can contain down to
qint64, QString, and nullptr_t. This should make it more type safe since
we don't want it to inadvertently end up holding lists or maps
(previously it was a straight up QVariant).

It has a conversion to QVariant so it should work nicely.
2019-11-09 01:55:48 +02:00
Calin Culianu
724d7d3366
Refactorings 2019-11-08 17:11:58 +02:00
Calin Culianu
8898e5c9ba
Fixed /stats endpoint 2019-11-08 03:15:47 +02:00
Calin Culianu
43b7e915c4
Got rid of more ShuffleUp stuff, added CLI args 2019-11-07 23:55:13 +02:00
Calin Culianu
b22f81a463
Minor removal of old references to ShuffleUp 2019-11-04 00:41:47 +02:00
Calin Culianu
01d8d01ccd Added stats HTTP server. Also refactored TcpServer 2019-05-09 02:12:58 +03:00
Calin Culianu
31b891c006 hooked controller object in to app startup 2019-05-04 06:00:01 +03:00
Calin Culianu
113efda25a Added spec rpc command from clients to us.. still need to do listunspent 2019-05-03 17:28:51 +03:00
Calin Culianu
b84bcbd8b5 Added Linux compile fixups. Also a check that the endianness in bitcoin:: is ok. 2019-05-01 18:19:17 +03:00
Calin Culianu
24b8e992b5 initial schema impl 2019-04-29 10:01:58 +03:00
Calin Culianu
2547dc35cb Added SysLogger for -S option which actually uses unix syslog()
On Windows it still prints to console, however (without timestamps).

Note that syslog mode doesn't produce any debug output even if -d is
specified (at least on macOS) -- probably the sysadmin needs to
enable debug logging.
2019-04-27 16:00:58 +03:00
Calin Culianu
5ccef909af Nits and refactoring of RunInThreads app exit handling 2019-04-27 14:55:10 +03:00
Calin Culianu
9366b6a244 trivial nit 2019-04-27 12:52:29 +03:00
Calin Culianu
631a3e5cf7 Windows: Fixups to handle signals CTRL-C on windows 2019-04-27 12:48:48 +03:00
Calin Culianu
3f49dce1db Added some small goodies
- Util::RunInThread to run a lambda in a thread
- App exit handling cleanup
- EXMgr uses an id for clients now
- EXMgr keeps track of lagging clients
- EXMgr more aggressive with reconnects if no valid exclients
- Nits and refactorings and misc. cleanup
2019-04-27 12:38:50 +03:00
Calin Culianu
56103a9299 Refactoring nits. Put default Options in Options.h rather than Common.h 2019-04-26 09:02:53 +03:00
Calin Culianu
2477a7a8a3 Added initial TcpServer stub implementation
- Already supports listening on as many sockets as you wish
- Each listening server has its own thread
- Will implement later: SSL server

Also refactored code a bit, created the generic "Controller" class, made
EXMgr and SrvMgr inherit from it.

ToDo: Figure out workflow for connections and clients, model client
sessions, etc.
2019-04-26 08:47:46 +03:00
Calin Culianu
e65bacd7fd Petit refactoring
- Made the stale timeout be 2 mins now
- Check clients runs every 1 minute
- Added 'Controller' ABC which EXMgr is one of and the TcpServer will be
another.
2019-04-26 06:23:49 +03:00
Calin Culianu
57148960c4 Added some command line options and a command line parser 2019-04-23 23:26:07 +03:00
Calin Culianu
4637012e22 Added more EXClient stuff 2019-04-23 12:36:51 +03:00
Calin Culianu
62101beeac Initial revision. Just laying out a skeleton to build on. 2019-04-23 02:33:16 +03:00