Commit Graph

117 Commits

Author SHA1 Message Date
tomFlowee c71ebb9bee Avoid reporting incorrect updates 2021-11-26 18:10:31 +01:00
tomFlowee 3a9863dbe3 Simplify the backup sync feature.
The bloom filter includes all the unspent outputs, so we can just
use the latest one if we want to get any transactions the first
peer omitted.
2021-11-26 18:04:38 +01:00
tomFlowee 9a65a2f9c9 Remove empty and sometimes hanging DNS 2021-11-19 14:16:41 +01:00
tomFlowee 1b5ae89d31 [Refactor] rename FastTransaction.{h|cpp} -> Tx.* 2021-11-02 11:05:14 +01:00
tomFlowee d79ab0a301 Special case peers that are behind
A peer that is behind is marked as "on a different chain", which is
ultimately correct, but the response to punish or ban them is too much.
We could very well reconnect later when the situation is resolved.

So, detect when a peer is simply behind and respond by disconnecting
without punishment.
2021-11-01 17:19:00 +01:00
tomFlowee 3841257505 Fix possible deadlock.
The new iteration avoids having the blockchain mutex locked when it
calls up to the connection manager (which locks its own mutex).
2021-11-01 15:52:55 +01:00
tomFlowee a7c8f02c09 Face the reality of low number of testnet nodes. 2021-10-31 15:14:34 +01:00
tomFlowee 701698d6e1 Fix merkleblock download as bloom filters change.
In HD wallets we get an issue where not-yet-generated keys are needed in
the merkle-block request and we notice this as a chunk of blocks is
being downloaded.
This is solved with some extra code.

Also avoid re-uploading the bloom filter during initial sync.
2021-10-27 19:14:09 +02:00
tomFlowee c5e845b11b Be more generous with asking for headers.
On connect, we should ask for a HEADERS overview from the remote peer,
even if we aren't fully at the tip yet.

Also remove some old lookup no longer used.
2021-10-27 19:14:09 +02:00
tomFlowee bdbde16e28 Make CleanPeers not ban good nodes 2021-10-27 19:14:09 +02:00
tomFlowee 1af7fea053 Fix too-fast-banning bug
Sometimes a node would not be online for a while and we'd incorrectly
ban them for a long time when we just need to mark them as not-
reachable-right-now.
2021-10-27 19:14:09 +02:00
tomFlowee 1efcc39f42 Avoid doing work for an empty wallet. 2021-10-27 19:14:09 +02:00
tomFlowee a5c4a308f4 We reached 700K, pre-allocate more :) 2021-08-09 21:22:25 +02:00
tomFlowee 6692a0a11a Follow API change in NWM.
Setting the ringbuffers to not-so-tiny values
2021-08-05 23:03:19 +02:00
tomFlowee d73763977c Avoid calls to listeners while we have a lock.
This is a library class, lets be nice to users of our class and
avoid deadlocks.
2021-07-31 18:25:24 +02:00
tomFlowee 77bd1ac74f Improve the SPV sync action.
This re-thinks the way we assign new peers and massively speeds up the
finding of enough peer for our wallets.
2021-07-30 16:56:25 +02:00
tomFlowee 0e6f2bec29 Add 'Last' priority. 2021-07-30 14:03:29 +02:00
tomFlowee 4411ecb2e5 Fix API docs. 2021-07-30 14:03:03 +02:00
tomFlowee 45851de8b9 Fix and add log message on action. 2021-07-30 14:02:33 +02:00
tomFlowee e998e64c8f Register task. 2021-07-30 10:01:31 +02:00
tomFlowee 0d8845386d API docs. 2021-07-30 10:01:06 +02:00
tomFlowee c8a531e6f8 Comments and fix warning
Statics should be PODs.
2021-06-24 19:10:14 +02:00
tomFlowee d18e13b93b Add new callback on DataListenerInterface when we synched headers 2021-05-28 14:53:19 +02:00
tomFlowee 460d4be807 Add new method Blockchain::blockHeightAtTime() 2021-05-28 14:52:27 +02:00
tomFlowee d17b8f0c40 Add API docs for new static-headers method. 2021-05-28 12:42:30 +02:00
tomFlowee c45e7d9c3e [P2P] Do not save blockchain data when not changed 2021-05-27 19:08:46 +02:00
tomFlowee d1fa3fa4a9 [P2P] Allow static loading of blockheaders
This adds a unit test for the Blockchain class in the p2p lib and this
introduces the functionality to have a blockchain pre-shipped with an
app.
2021-05-27 19:08:46 +02:00
tomFlowee ccb1016ac7 Avoid deep-copying a bloomfilter when possible. 2021-05-27 19:08:46 +02:00
tomFlowee d3f1d7f454 Whitepace and minor fixes. 2021-02-05 17:32:36 +01:00
tomFlowee ceb44cc3b5 Remove dead code. 2021-02-05 17:26:40 +01:00
tomFlowee f026e626a1 Add notifications for the p2pnet lib. 2021-02-05 17:22:52 +01:00
tomFlowee 70f363cabb Also allow downloading of dsproofs. 2021-02-04 18:09:38 +01:00
tomFlowee 44e8717d1e Send a MEMPOOL message on SPV/merkleblock sync. 2021-02-04 17:39:44 +01:00
tomFlowee 1f2f7c36d2 Port the boost container to the std one.
The unordered_map is now available in stl, and said to be better,
so lets slowly switch over
2021-02-03 16:31:46 +01:00
tomFlowee 1003ad716b Fixlets in log output consistency 2021-02-03 14:41:51 +01:00
tomFlowee 5d6d09e4d6 Assign segments only to good peers
Instead of assigning a privacy segment at connect, wait until we have
determined if this peer is on the same chain as us before we allocate a
peer slot.

This also helps us limit the amount of peers we send our bloom filter to.
2021-02-03 14:41:51 +01:00
tomFlowee 447a2e12e6 Add new action
When a peer never sends headers we now ban it after a timeout based on
the idea that we don't even know if this peer is on the same chain as we
are.
2021-02-03 14:41:51 +01:00
tomFlowee 5baaf984ab Add API docs
also add setInterval()
2021-02-03 14:33:38 +01:00
tomFlowee adfe4081cb Update copyright notice and email address 2021-02-02 13:08:07 +01:00
tomFlowee 3dff9b157d cleanup includes 2021-02-02 13:05:19 +01:00
tomFlowee 7647dde2b5 Handle DNS feeds better.
Avoid issues when the DNS is slow.
Increase the score of an IP that is part of a feed.
2021-01-13 18:15:33 +01:00
tomFlowee c5fca38956 Check basedir or throw
This makes the download manager fail fast, with appropriate logging, on
misconfiguration.
2021-01-13 12:00:15 +01:00
tomFlowee 3fe98afce9 Minor cleanup
This removes some unused includes from common headers and dead code
from some C++ files.
2021-01-05 22:05:25 +01:00
tomFlowee 2f26329eb9 Add some API docs 2021-01-05 21:29:14 +01:00
tomFlowee 8e44b058af Add flags getter 2020-12-17 09:08:34 +01:00
TomZ 93148976e9 add the checkpoint to p2pnet 2020-11-15 15:27:32 +01:00
TomZ 37e1f2fcd3 Fix bad usage of create_directories() 2020-11-14 23:59:01 +01:00
TomZ 2b7ae939cf Simplify the syncchain action. 2020-11-13 21:03:56 +01:00
TomZ 301a4ca3ee Fix properly following the chain-tip
This is done in several steps:

1. Separate my height from the remote peer heights.
Instead of assuming we have one height, recognize that a peer may
not be at the tip at the same time we are. We monitor headers/invs
to update the 'peerHeight' variable.

2. Ask for merkle blocks from a peer to the maximum height of that
peer (but not later than what we validated to be true).
This avoids us asking past the remotes tip which they didn't like.

3. Redo the SyncSPVAction to use all this and make it much more
reliable in finding peers to download from and getting all the
changes as fast as possible.
2020-11-13 21:03:56 +01:00
TomZ 5fa1b50fa1 Remove duplicate 2020-11-13 20:09:29 +01:00