Commit Graph

767 Commits

Author SHA1 Message Date
TomZ a790b26133 Just warn about failing to write to a legacy blk
Boost throws an exception when the resize fails, which would cause
a total shutdown of the client. So make sure we catch it in the
scheduled task to avoid this problem.
2020-03-01 18:27:28 +01:00
TomZ 0e6231e636 Add a check to only write when not loaded
In some unit tests I noticed that we write a block that was just loaded
from disk, this check avoids this overhead.
Not sure how relevant this is for normal operations.
2020-02-28 12:55:16 +01:00
TomZ 7e7f42e8ec Make de-orphaning code no longer recursive.
The recovering of orphans was recursive and that meant there was a max
length of headers we could process with a gap in the chain due to normal
stack-depth for recursivity (approx 50k).
As headers are being provided to us from external peers this could be a
DOS vector.

This implementation avoids this problem by not being recursive.
2020-02-28 00:34:12 +01:00
TomZ 1141de5c13 Cleanups 2020-02-28 00:34:12 +01:00
TomZ 9a3dde8400 Make sure the UTXO doesn't write a new info file when there are no changes 2020-02-28 00:34:12 +01:00
TomZ 60d371afa7 Make loading find a functional UTXO state
When, on loading, the blockindex and the UTXO don't agree then try to find an older UTXO
state where they do agree.
The most typical state issue is where a block stored in the blocksdb is not available in
the index due to corruption or similar.
2020-02-28 00:34:08 +01:00
TomZ f0e93708e1 Minor cleanups 2020-02-28 00:33:11 +01:00
TomZ 30927fe0b2 Fix reindexing sometimes failing due to read-only blocks
When reindexing we now always first try to open a file read-write because
the algo to only open the last file in a sequence as RW failed in such
situations where we don't know the amount of files yet.
2020-02-28 00:33:11 +01:00
TomZ 489a9a4859 Move nStatus of blockindex into the UTXO
To allow the UTXO to actually use the power of checkpoints we need to
make sure that the block-validation state is not stored separately from
it.
The goal is that when we have some curruption we can just go back to an
earlier state of the UTXO and re-validate the blocks to get to the
current tip. The often seen problem is that corruption will instead
leave the block-index (leveldb) with an incorrect state so the replay
fails.

This change solves that by no longer reading the block-validation-state
and no longer writing it on a state change.
2020-02-28 00:33:04 +01:00
TomZ a1b4c0416d Avoid clearing an empty bloom filter 2020-02-27 23:26:20 +01:00
TomZ 99a78eb60a remove dead code 2020-02-27 13:51:21 +01:00
TomZ 8057429dfa Re-do the UTXO garbage collect planning algo
The UTXO keeps outdated records around in an append-only file, which
means we need to do a garbage collect regularly.
This new algo uses the commulatative amount of changes since last GC
(aka prune) as an indicator to plan a new one.

The effect should be much smaller files to keep in memory and the data and
jump tables being much more localized which should result in higher
throughput.
2020-02-23 11:15:55 +01:00
TomZ 86d580463a Make selection of UTXO info files better
This avoids some cornercases.
2020-02-22 13:43:16 +01:00
TomZ 00d4905db2 Provide another convenience method for making messages
THe builder now allows you to create a message with the
serviceId, the messageId and the requestId pre-set.

This benefits code that just takes the output from the
builder and calls 'send' on it immediately saving several
lines of code.
2020-02-19 16:55:46 +01:00
TomZ 05048a2109 make non-debug builds more useful for unit tests in debug build 2020-02-19 16:55:46 +01:00
TomZ 999772a748 Allow usage of the logger outside of Flowee
Ship unit-testing functionality in the releease builds too,
external users may want to compile their apps in debug mode while
flowee is a release build.
2020-01-30 15:29:03 +01:00
TomZ 4bea1f55c4 use QElapsedTimer 2020-01-30 15:29:03 +01:00
TomZ 11d16001c6 Indexer: add get for current sync-height 2020-01-20 12:17:55 +01:00
TomZ a01fbab2b7 Update tests and fixes in bitcore-proxy
this fixes mixups when more than one output of a transaction was used in
our search.
2020-01-17 19:44:29 +01:00
TomZ cb5d9d16f6 Fix usage of exceptions
Throwing an exception instead of returning false means we blacklist the
txid from being downloaded multiple times.
2020-01-15 17:11:27 +01:00
TomZ c672f80374 Catch exception from DSP::create() 2020-01-14 12:36:19 +01:00
TomZ c0ba4e49fb RPC getrawtransaction allow 'true' for bool
This allows fulcrum to work with this old API method.
2020-01-13 23:23:49 +01:00
TomZ 58299fcd70 Add 'initialblockdownload' bool to RPC getbclockchaininfo 2020-01-13 17:42:50 +01:00
TomZ 2e3f59716f Add claimOrphan() 2020-01-13 11:27:47 +01:00
TomZ 6e6f43a0d4 Remember peerID in DSP-orphanage
So when we adopt one proof, and it turns out to be faulty, we can
punish the peer.
2020-01-12 18:06:23 +01:00
TomZ e042fb90f5 Cancel timer on shutdown 2020-01-12 18:05:09 +01:00
TomZ 071629852a Treat DSP orphans with dignity
This improves the double spend proof orphans code.
Also add a DSProof log-category and lots of log lines to make
looking at a debug build much more fun.
2020-01-12 17:41:53 +01:00
TomZ d6a2488b5c Cleanup some DSP issues
remove the need for 'flags' as this code block doesn't use the
current flags at all.

Also validate proofs that were restored from orphan cache.
2020-01-12 17:10:29 +01:00
TomZ 2b68d149de Cleanups 2020-01-05 16:47:49 +01:00
TomZ 7e01498eba Add operator== to class Tx 2020-01-04 21:08:38 +01:00
TomZ 06535153b0 Remove unused argument. 2020-01-04 15:25:15 +01:00
TomZ d93faff5a3 Fix C++11 compiler warning
also fix potential memory out-of-bounds write issue.
2020-01-04 14:20:22 +01:00
TomZ a305edcafe Fix some compiler warnings. 2020-01-04 14:00:17 +01:00
TomZ 83b7243b70 Prepare for the 2020.01 release
From now on, make sure that the minor always has at least 2 digits
which allows us to use string compare of versions even if we have
more than 9 releases in a year.
2019-12-31 18:05:24 +01:00
TomZ 3315aec93f Add ConstBuffer::operator==() 2019-12-30 17:37:23 +01:00
TomZ a1cb53e603 Delay callback until end
This allows us to do sends from the callback.
2019-12-30 17:25:26 +01:00
TomZ 50fc8dd024 Make available some helper methods as protected 2019-12-27 21:31:44 +01:00
TomZ 92fabcac85 Merge branch '2019.10' 2019-12-23 13:24:27 +01:00
TomZ d15998e658 Provide a safe way to modify jobs out-of-thread
The FloweeJS component uses this class but requires the usage
of the NodeJS 'main' thread. Which needs safe access to the jobs
list at the same time the Flowee workers need access.
Simple solution; add a mutex.
2019-12-23 13:20:08 +01:00
TomZ aef124e523 Merge branch '2019.10' 2019-12-17 17:58:34 +01:00
TomZ 1143a71a92 Fix assignment typo 2019-12-17 17:57:08 +01:00
TomZ f4d8870001 NWM: tweaks to logs. 2019-12-17 17:36:15 +01:00
TomZ 6e8c0b29f7 Also here, report minor ver as hex.
Also fix some compiler warnings
2019-12-12 17:48:48 +01:00
TomZ 95646682b3 Use hex for the client minor number.
This makes string comparisons much easier (a > 9, while 10 < 9).
2019-12-12 17:34:14 +01:00
TomZ 8c842fa108 Catch exceptions on usage of socket
This should fix the issue where the NWM stopped listening due to us not
calling the proper setupCallback()

Also add some logging.
2019-12-11 23:47:21 +01:00
TomZ ea1ab3c987 Fix interpreting API results. 2019-12-10 17:39:17 +01:00
TomZ 7a360f5a3d slight logging updates 2019-12-09 15:15:52 +01:00
TomZ 85d5dac081 add is{Hub|Indexer}Connected() methods. 2019-12-09 15:13:37 +01:00
TomZ ad65d8010b Fix check for coinbase in search API. 2019-12-09 15:13:37 +01:00
TomZ 0e02f9796d cleanup 2019-12-09 15:13:37 +01:00