Commit Graph

12776 Commits

Author SHA1 Message Date
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
tomFlowee 17fd9b84e2 Always fetch the DNS feeds 2024-01-28 21:31:28 +01:00
tomFlowee 9fd2e37bba Ensure we ask for the mempool details also when there are no new blocks 2024-01-28 21:31:28 +01:00
tomFlowee e508631885 The effects of resetAll was better than just pardons 2024-01-28 21:31:28 +01:00
tomFlowee 3f9bb5ba06 Don't assign a peer to an archived wallet
Just because this action doesn't open connections to such peers doesn't
mean they may not have been opened by someone else.
2024-01-28 19:54:54 +01:00
tomFlowee 2e50054d69 Tweaks to the punishment values. 2024-01-28 19:53:59 +01:00
tomFlowee ffe458a1f6 Remove unused member 2024-01-28 19:51:56 +01:00
tomFlowee 9d980fdcad Minor tweaks to IP selection.
When we didn't personally verify the services, don't judge the IP based
on them and connect anyway.

In addition to not trusting the services we receive from the net, be
more careful with the usage of the 'lastConnected' field.
Notice that we don't actually use the result of that variable in the end
if the everConnected is likewise incorrect.
2024-01-28 17:01:01 +01:00
tomFlowee dc9ef827b4 Fix various issues in the addressDB
this introduces a new version of the address-db, as stored in the db
file itself. Causing a one-time 'upgrade'.
Main issue solved is that the 'everSeen' bool was restored incorrectly
and from then on out saved wrong too.
This may have caused bad selection of peers to connect to as the DB
grew.

Together with the various bugs in the last months update we also reset
the punishment to not avoid connecting to possibly perfectly fine peers.
2024-01-26 13:32:39 +01:00
tomFlowee 249ea8c2c8 Add new callback for peers before the handshake. 2024-01-26 12:08:03 +01:00
tomFlowee eace700859 Add EndPoint::isOutgoing() -> bool & isIncomimg() 2024-01-24 21:06:25 +01:00
tomFlowee dcdeb6dec0 Don't assume company name in this library class. 2024-01-24 21:03:58 +01:00
tomFlowee 9ad2ec7c02 Be consistent, use a subdir for header files. 2024-01-24 21:03:58 +01:00
tomFlowee 01b7d9eb45 Remove this old file 2024-01-24 21:03:58 +01:00
tomFlowee 5c4d6a987d Add the missing headers to this combined set 2024-01-24 21:03:58 +01:00
tomFlowee b6958d4ad7 Install the combined header too 2024-01-24 21:03:58 +01:00
tomFlowee 4fe9d69e7b Use more specific define-guards 2024-01-24 21:03:58 +01:00
tomFlowee ef95af0177 Define the lifetime better.
A connection that is 'shutdown' now ensures one more time we'll call
onDisconnected() (is it was..) allowing the application level logic to
get notified and avoid memory leaks.
2024-01-24 21:03:58 +01:00
tomFlowee 40e5eaa78d Add EndPoint::toString() 2024-01-21 23:16:56 +01:00
tomFlowee ffca9b3418 Refactor the BroadcastTxData slightly and pass in the peer. 2024.01.2 2024-01-18 21:46:08 +01:00
tomFlowee 0adb3b5307 Relay of transactions is an essential requirement for us
In practice this won't change anything, but this closes a DOS-like attack
on p2plib using apps where we give slots to peers and then skip using them.
2024-01-18 21:45:11 +01:00
tomFlowee b1749e4c8c Fix peer selection to send tx to. 2024-01-17 19:49:13 +01:00
tomFlowee f1b410dbd0 Fix copy paste error 2024-01-16 10:45:32 +01:00
tomFlowee 18b14a97bc add method to pardon sinners 2024-01-14 17:07:38 +01:00
tomFlowee 542eaa0605 fix logic and be faster to sync.
The intended logic now works which avoids us now finding a download
source faster.
2024-01-14 12:26:01 +01:00
tomFlowee 5fec1b94ef Fix off-by-one in headers check.
A headers call that notifies us about a new block, which is identical to
the one we already have as TIP is now recognized as having the same POW.
2024-01-14 12:16:29 +01:00
tomFlowee e16fb40146 Avoid destructors more for de-registration
This allows us to use a shared pointer while at the same time not having
the problem that a peer de-registration hits an already deleted
PrivacySegment.
2024-01-13 19:26:55 +01:00
tomFlowee 98260e15ac Add API docs. 2024-01-13 18:07:39 +01:00
tomFlowee 874c898430 Remove unused include 2024-01-13 18:06:58 +01:00
tomFlowee ccd53255f8 Avoid doing unneeded work.
When the user-layer triggers a re-connect instead of waiting for the
layer to re-connect then we should avoid doing work twice.
This also avoids a reconnect in some cases.
2024-01-08 16:57:50 +01:00
tomFlowee 64bfb76e06 Linter found issues, we fix 2024-01-08 14:01:21 +01:00
tomFlowee 3f2068b520 New version 2024.01.1 2024-01-07 12:33:34 +01:00
tomFlowee 8d5c1604f8 Add accessors for the ip version support
The AddressDB stores separately the ipv4 and ipv6 addresses, ensuring
that the caller only receives IP addresess compatible with what they
asked.
Until now the booleans to define this were simply private members of the
DB and ipv6 was off.

This exposes those boolean to the outside world.
2024-01-06 22:01:00 +01:00