Commit Graph

12858 Commits

Author SHA1 Message Date
tomFlowee 6a84a262cc Add more ConstBuffer helper methods
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.
2024-06-11 17:57:17 +02:00
tomFlowee dc3545857d [p2pnet] Add Blockchain::replaceStatichain()
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.
2024-06-02 21:22:37 +02:00
tomFlowee 5ada583bd1 Fixlets in code and comments. 2024-06-02 11:58:05 +02:00
tomFlowee dcaddcca7c Remove unused include 2024-06-01 19:22:27 +02:00
tomFlowee 7ecd46ba1c Make checkpoints available via method call.
This also adds docs.
And this moves away from the map which isn't worth the code complexity
with the low number of entries.
2024-05-31 13:05:38 +02:00
tomFlowee 422822530b Add Blockchain::dataSources() getter
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.
2024-05-28 10:51:52 +02:00
tomFlowee 6229055dd2 new release version 2024.05.0 2024-05-05 21:30:27 +02:00
tomFlowee 4845de2470 Add PrivateKey::fromBase58() 2024-05-01 21:55:25 +02:00
tomFlowee e28b5e1823 Make simpler 2024-05-01 21:54:22 +02:00
tomFlowee 4f3fd8b5bd Add support for xpriv import on HDMasterKey
This essentially adds support for a derived HDMasterKey to exist.
2024-05-01 21:54:19 +02:00
tomFlowee 2cd73ba4fb Add xpriv creation with derivation path. 2024-04-29 21:13:03 +02:00
tomFlowee 65517840ac Add level() getter 2024-04-26 16:56:44 +02:00
tomFlowee 8da1892995 Add ConstBuffer toHex() methods to get a string out. 2024-04-21 00:11:47 +02:00
tomFlowee 3e9cf0173f Add assert to avoid misuse and mem issues. 2024-04-21 00:11:07 +02:00
tomFlowee 2bb858b62d Tweak UTXO numbers
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.
2024-04-07 20:19:46 +02:00
tomFlowee b749d4fbe5 Minor changes 2024-04-07 20:19:46 +02:00
tomFlowee d4b1d240f0 Add unspentdb export --no-export argument
This basically just walks the of records without actually exporting
them.
It will nicely print related info files, number of actual records found
etc.
2024-04-07 20:19:46 +02:00
tomFlowee 665d61eeb4 Add various helpful warnings and info messages. 2024-04-07 20:19:46 +02:00
tomFlowee 20e6b356da Add ability for Export to take a dir
This will iterate over all DBs and list all of them.

Additionally, add a 'height' option to list at a specific height.
2024-04-07 20:19:46 +02:00
tomFlowee d680346e25 Make the command line arguments a bit clearer
This allows us to explicitly specify dir/info/db arguments.
2024-04-07 20:19:46 +02:00
tomFlowee 1165da7336 Make bloom filter cheaper 2024-04-05 12:38:21 +02:00
tomFlowee 995750fc99 Increase the requested FD count
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..
2024-03-28 16:16:48 +01:00
tomFlowee f84c61e187 Follow styleguide; methods start with a lowercase char. 2024-03-20 19:12:50 +01:00
tomFlowee 517a90abeb Detect too many orphans
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.
2024-03-20 19:11:58 +01:00
tomFlowee f1505c0ac7 Handle a large set of metadata files better
Don't wait more than 10 seconds for missing DB data, we'll have to
conclude they won't be forthcoming and just register this in the log.
2024-03-20 19:05:38 +01:00
tomFlowee 96660d90c6 remove unused includes 2024-03-20 19:03:10 +01:00
tomFlowee 53d417e727 Allow using tiny DB files.
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.
2024-03-19 09:08:55 +01:00
tomFlowee 2983c8e7a0 Add txversion getter/setter 2024-03-13 17:02:19 +01:00
tomFlowee f62acbed6b New version 2024.02.0 2024-02-27 19:43:19 +01:00
tomFlowee 6ade318b2e Introduce interleaving during download
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.
2024-02-23 22:08:28 +01:00
tomFlowee a53d03c5a3 Avoid too harsh a reaction on slowness
Afterall, the slowness can very well be temporary.
2024-02-23 22:01:48 +01:00
tomFlowee 58ec8fb8f8 Fix typo in enum name. 2024-02-23 17:28:40 +01:00
tomFlowee 6b88f6ad7b Ensure addressDB is updated upon connection.
Even if the user disqualifies the connection, we should still register
that there was a successful handshake.
2024-02-14 16:20:02 +01:00
tomFlowee 8a0ece8316 Doc fixes 2024-02-14 00:16:39 +01:00
tomFlowee ee354b62d1 Avoid repeating myself. 2024-02-12 21:29:33 +01:00
tomFlowee 64fa922605 fix whitespace 2024-02-12 21:16:55 +01:00
tomFlowee b93a993eaf Fix rare case of not downloading 1 block.
If between the first peer finishing downloading and the second
finishing downloading a block was mined, we need to pick a different
peer for the block the first one didn't download.
2024-02-10 19:50:44 +01:00
tomFlowee 3877df4e2f Improve comment grammar 2024-02-10 19:49:15 +01:00
tomFlowee 04fd3bbf1d Treat DNS based addresses as more reliant 2024-02-10 19:49:00 +01:00
tomFlowee 99c63db936 Try new peers more agressively
Every cycle (1500ms) we try to connect to a new peer if we're low on
peers.
This avoid waiting for a connection to time-out.
2024-02-09 21:12:45 +01:00
tomFlowee 6fc769af55 Remove old config ifdefs 2024-02-09 18:52:04 +01:00
tomFlowee 1125e5d329 Add new field 'tried'.
For addresses that we tried to connect to, even though it may
have failed to actually reach the handshake phase.
2024-02-09 18:52:04 +01:00
tomFlowee feb3b29a08 Tweak numbers 2024-02-07 16:30:20 +01:00
tomFlowee c6548c82e6 add more seeds 2024-01-30 20:50:53 +01:00
tomFlowee 2612db6fb4 Add IP to log message 2024-01-30 20:48:36 +01:00
tomFlowee 4cb4100cec Check peers more agressively
With the expansion of the database more agressive, checking a
larger set of peers for one that works becomes more important, as
such open more connections ever cycle if we can't find good ones
after half a minute.
2024.01.3
2024-01-29 13:03:25 +01:00
tomFlowee 13d494efef Check more datapoints
With the expansion of the database more agressive, checking a
larger set of items for the best one becomes more important, as
such do a 10x for finding the best sccoring item.

The observed effect is finding previously useful peers within seconds
instead of a minute.
2024-01-29 11:54:40 +01:00
tomFlowee 9452bfb4f1 New version 2024-01-28 21:35:42 +01:00
tomFlowee 35be013a19 Detect low number of usable addresses
When our addresses database is filled with old or wrong addresses, we
end up trying to connect to a large number of IPs before we find actual
peers.
When we see that is the case, let's try to find more IP addresses from
our peers.
2024-01-28 21:31:28 +01:00
tomFlowee 5d00848897 Check addresses are on our chain
Validate that the addresses message we received are from a peer we
actually validated as being on our chain.
2024-01-28 21:31:28 +01:00