Commit Graph

801 Commits

Author SHA1 Message Date
TomZ 6643059f2a Forgot to add copyright headers to these files 2019-06-04 21:40:12 +02:00
TomZ 0c9f415eb8 Several NetworkManager fixes
This adds all the header ints to chunked messages, solving the problem
of losing RequestId on roundtrips if the answer was too big.

Added a unit test for this "new" features.

This makes callbacks all use shared_from_this() in order to avoid
callbacks being done on deleted instances (thanks boost!).

Last, special case when the user doesn't connect but just sends messages
which caused a send of data, only to realize the connection wasn't open,
and then a connect.
This makes sure we immediately start a connect on queue of a message.
2019-06-04 21:40:02 +02:00
TomZ 57b0b58aa7 Add code to stream a NetworkEndPoint to Logger. 2019-06-03 21:41:04 +02:00
TomZ d10e50803c Avoid warnings from Qt.
Lets not ask about m_verbose when we didn't add it to the parser at all.
2019-06-03 21:39:37 +02:00
TomZ d0662d6e22 Install more headers. 2019-06-03 21:37:30 +02:00
TomZ ca2d6b041a fix connection() not finding an existing connection 2019-06-03 14:37:08 +02:00
TomZ a00938a118 Fix race condition in shutdown of NetworkConnection 2019-06-03 14:37:08 +02:00
TomZ 50870520df Fix NetworkConnection::isConnected() behaviour
This brings it closer to what we expect.
2019-06-03 14:36:59 +02:00
TomZ 08ca3c59c9 Set sane default log levels 2019-06-03 10:59:33 +02:00
TomZ a1dfd1cde9 Work on installable headers 2019-06-03 10:59:33 +02:00
TomZ b6faee185b signal reparseConfig on FloweeServiceApplication
When a user sends a signal SIGHUP, we parse the configs again
traditionally on Unix.
We already use this for log-configs.
This signal allows apps to get notification and reload their
own configs.
2019-06-03 10:59:33 +02:00
TomZ 7203a058a3 Change API call SplitHostPort slightly
Instead of taking an int for the port, take a short.
This matches better with the networkmanager EndPoint struct.
2019-06-02 20:16:49 +02:00
TomZ f868a8274e Make all protocol upgrades equal.
The "UAHF" one used to be "more equal", mostly just because it happened
to be the first.
This makes them all equally equal.

Specifically this removes the special casing and the enum for the 201708
HF (aka BCH fork-point).
We select the right branch now purely based on the historical check-
points.
2019-06-02 13:57:47 +02:00
TomZ db9eb1adfb Install some more files 2019-05-30 13:36:57 +02:00
TomZ e6a23d5f4f Merge branch '2019.05' 2019-05-27 09:28:25 +02:00
TomZ 702addadbb Remove race-conditions in connecting 2019-05-27 09:27:26 +02:00
TomZ 517d0b796d Fix determination of manual reorg
The "Greater than 6 blocks" can be off when we are doing IBD where
headers and chain are not pointing to the same block. Make sure this
works for such an occasion as well.
2019-05-27 09:27:19 +02:00
TomZ 2acde0f30a Allow no progress in download for 6 seconds instead of 2
before disconnecting.

As this only applies to IBD, we can take into account that we have a
higher number of connections typically and this helps stability.
2019-05-27 09:27:14 +02:00
TomZ 01459ec961 Refactor; move lastCommonAncestor to Blocks::Index ns
Out of the main.cpp and usable for a bigger audience.
2019-05-27 09:27:08 +02:00
TomZ 8ed6d6a3e2 NWM: Fix reconnecting a dead connection
A disconnect would cause the socket to close which caused a
callback which triggered a timer to reconnect after half a minute...

This makes sure that after we manually disconnect we honor that.
2019-05-27 09:23:05 +02:00
TomZ a20118c5fb Add LiveService unit test
The bugreport claimed that sending an existing coinbase would give
inconsistent results. This test can't find any unexpected behaviour.
2019-05-27 09:23:05 +02:00
TomZ 18035c2e66 Start new testing setup for API testing
This is a blackbox type testing for specific API calls.
2019-05-25 17:06:23 +02:00
TomZ 38b4e8b189 Allow hubs -apibind to use 'localhost' string
The command really only accepts IP addresses, but we use 'localhost' as
an exception to bind to loopback for ipv4 and ipv6 at the same time.

Also improve logging of errors and avoid failing to start the API
service if a bind address wasn't an IP.
2019-05-24 23:14:15 +02:00
TomZ 26fda112a0 Fix bug in API for where the answer is a plain bytearray.
This allows RPC wrapper classes to reuse the default implementation also
when the answer is not a uint256
2019-05-23 12:12:25 +02:00
TomZ 59c41123c1 Fix regression, throw when not found. 2019-05-22 23:12:44 +02:00
TomZ a5e8ea401a Sync the new AddressMonitor service API with others
the OffsetInBlock token now has the same value as with other services.
2019-05-18 16:03:26 +02:00
TomZ a54107c168 Make NetworkService thread-safe
This makes the access to the per-peer datastructure lock-free and
thread-safe.
2019-05-18 16:03:22 +02:00
TomZ a1c9e80db0 Make APIs internally consistent.
Where we wrap the old RPC code we need to revert the byte-order from the
strings created there for the uint256.

This simplyfies the code by introducing a helper method.
2019-05-17 20:48:16 +02:00
TomZ 1f52ae7a7f FloweeServiceApplication: support net wildcard
For service applications that bind to networks (currently
only indexer) this allows users to pass the address:
    0.0.0.0
to bind to. The effect will be that we find all the network
interfaces in the system and bind to all of them.
Notice that we already had "localhost" as an alias to bind to both
v4 and v6 loopback interfaces.

This new feature depends on optional dependency QtNetwork.
2019-05-17 12:32:11 +02:00
TomZ 6a8313252d Merge branch '2019.04' 2019-05-15 20:45:18 +02:00
TomZ 5996205a07 add checkpoint and set PU blockheight 2019-05-15 20:44:47 +02:00
TomZ 4addb23158 Fix off-by-one
This is rather embarrasing, but I have to ask why fully synching the
testnet created precisely for this fork (to the same height as the
explorers) didn't fail. Did it not have any schnorr signatures? Otherwise
this bug would have shown.  What good is a testnet then?
2019-05-15 20:17:55 +02:00
TomZ 34bcbd775e comment out debug log 2019-05-15 19:55:18 +02:00
TomZ ba2216d582 Add to CLI clients verbose/quiet options
All client apps (=connecting to a server only) now gained the  verbose
and quiet command line arguments to select a different level of
verbosity.

Servers don't need this as they use a config file.

This also makes the --debug option only for debug builds as the logging
system already doesn't compile in debug statements otherwise, it makes
little sense to try to print them.
2019-05-13 18:27:09 +02:00
TomZ 7fbb6772de NWM: Promote some debug level to warn/info 2019-05-13 12:20:57 +02:00
TomZ 5b155600d9 Make app arguments more consitent
Now everyone auto-connects to localhost unless passed the
option --connect=

Also make indexer find the logs.conf from the same dir as the
commandline passed config file.

This makes running it as a service more useful.
2019-05-09 12:16:11 +02:00
TomZ 8d716cba28 Allow log path to be a dir
Allow logs.conf to supply the file-path as an (existing) directory which
will lead to the result of opening the standard filename in that dir.
2019-05-08 17:04:09 +02:00
TomZ 4995215f2d Fix API inconsistencies
The rule is that all sha256s are serialized like they are printed (so
zeros first for a blockID), this updates various places in the API did
reversed this order.
2019-05-08 12:49:33 +02:00
TomZ d450b73358 revert adding reproducable_build cmake option 2019-05-08 11:15:54 +02:00
TomZ 26747573f7 Import protocol version numbers 2019-05-08 10:53:18 +02:00
TomZ e1388b8ce7 Disconnect nodes that follow a different chain
Nodes that follow a different chain (and thus send us headers that we
already invalidated) now get an immediate disconnect whereas before
we could keep them around for an hour.
2019-05-08 10:51:46 +02:00
TomZ 32c45610cd Further fixes for cashier / PoS
Also upgrade the cashier app with logging, ctrl-c catching
and debug + version command line arguments.

Last, this checks the server version and exits if the Hub
version is too old.
2019-05-08 09:07:17 +02:00
TomZ 8d81cc5471 Create new lib apputils
This lib depends on QtCore, as such it is separated from other libs. As
many apps depend on QtCore we can share classes here to avoid
duplication.
2019-05-07 20:53:22 +02:00
TomZ 82a8e137bb API reviews
Rename 'RawTransaction' to 'LiveTransactions'
Review the AddressMonitorService.
Cleanup and remove some unused items (but keep binary compatible).
2019-05-06 20:13:10 +02:00
TomZ e137a7b59f Add simple memcpy constructor to KeyId / uint160 2019-05-06 14:45:12 +02:00
TomZ 8e191f6fd5 Implement some TODOs in blockvalidation 2019-04-28 23:02:58 +02:00
TomZ a7f9b9fed5 Remove obsolete code.
Remove txIndex option, its move to Flowee Indexer

Also remove the GUI option for setting the amount
of "script validator threads". :D

Remove DBCash command line option too, equally obsolete.
2019-04-22 21:16:10 +02:00
TomZ d20dd6d70a Cleanup; block-pruning
This has been commented out code for some time and its probably best to
remove dead code so as to avoid it rotting.
2019-04-22 20:33:49 +02:00
TomZ 2577b6f7ef Merge branch 'may19PU' 2019-04-22 12:51:07 +02:00
TomZ 5c7caf35e4 Merge branch '2019.03' 2019-04-22 12:50:21 +02:00