The cmake boost integration has changed, which means we need to
test how to do this over a large number of setups to do
it "correctly" and that's going to be a task for later.
For now, lets avoid the message and make clear we want to keep
the old behavior.
The checkpoints were formerly copied from the full node, so based
on possible fork-events.
That seems less useful nowadays and since we want to be able to
allow starting a blockchain instance from any checkpoint it makes
sense to spread them out more evenly.
Based on the concept that the BCH chain generates around 50K blocks
a year, we simply use that interval.
This removes various very old ones meaning that the total count is
roughly equal.
This improves the docs, adds a getter and last it makes the
blockHeightAtTime() more secure by not returning a value below the
checkpoint. As this would throw if used directly in the block() method.
This adds endsWith() and an extra startsWith() overload.
We also added tests for the case when either the argument or the object
are empty and specify the behavior. I copied the behavior of QString.
See unit tests that specify the behavior with empties.
This public method allows an application to replace the static-
header files in a life-situation. Without needing to restart the app.
The idea is that a static chain starts at a checkpoint, and we extend
it into the past to start at an earlier checkpoint. This suddenly
makes available a larger amount of history without changing anything
of the data that was already there.
The blockchain object holds all block-headers, the backing store for
this class is now being exposed more to allow understanding what we have
or not have available. And also what the source of that info is.
As the "normal" machine that runs this kind of software gets more
memory, it is Ok to increase the numbers in order to aim to keep more
data cached in memory between check-points, and have less check-points.
This mostly helps speeding up initial block download, it also helps keeping
the utxo datadir small and non-fragmented. All good for speed.
Our database uses memmapping and each blk file allocates a file-
descriptor (FD). As such we should increase the number at the start of
the app, if we can.
Notice that the 2000 is chosen to work with a full node that still uses
tiny blk files (128 typically) instead of 1GB files as the Hub makes by
default.
Also fix a bug in the handing code. Using the hardcoded default
FD_SETSIZE made no sense there..
If for some reason there are a massive amount of orphaned headers, we
don't just keep them around until they are resolved as that is
detrimental to the operation of the node.
Special case this for a reindex and simply skip all orphans fur the
duration.
Doing a -reindex on a datadir of a different client gives us thousands
of small blk files, which may result in us hitting the max simultaneous
open files limit.
This change forces us to flush the list a bit more aggressively and
close open files.
The download from a peer is now limited to just 4000 blocks, at which
point the download proceeds from another peer.
Naturally it can go back to the first afterwards too.
The idea is that we download a month worth of blocks at a time and then
fetch the same blocks from a backup peer in order to be certain we
actually see the real state.
The problem we've seen is that after the first downloads we end up
starting the second and if the initial sync or a similar large download
happens, many people won't leave it running until the backup actually
completes since the UI looks like its finished.
This is also a good starting point for rating peers at download speed by
having predictable chunks and that means we could time and aim to use
the faster peers.
This is becoming relevant as we can see a huge difference where peers
give you 10x performance compared to some of the slower ones.