Commit Graph

7627 Commits

Author SHA1 Message Date
lunar-mining
06ae4fd054 settings: change refinery interval default to 5 seconds
we reduce this in light of 4bf43ec521.
Hostlist sharing now works as follows:

* Start node
* wait 5 sec
* start greylist refinery
* send whitelisted entry to peers
2024-01-16 13:56:49 +01:00
lunar-mining
4bf43ec521 net: downgrade whitelist to greylist on stop
This commit forces all whitelisted peers through the greylist each time
we start a node, thus ensuring that whitelisted peers are in fact
reachable.

Otherwise, our whitelist risks getting polluted with unreachable
whitelisted peers. While the greylist has a refinery process to deal
with this, the whitelist has no such process.
2024-01-16 13:49:37 +01:00
lunar-mining
c0e23dca86 net: fix ports on test 2024-01-15 17:55:19 +01:00
lunar-mining
ec5abf9683 net: make clippy + fix test 2024-01-15 17:03:41 +01:00
lunar-mining
4f4e4fb5b3 net: small integration test tweaks 2024-01-15 16:05:38 +01:00
lunar-mining
5f83327aec chore: delete unused methods 2024-01-14 16:47:48 +01:00
lunar-mining
bd0c7684c8 outbound_session: replace downgrade_host() with rejected vector
downgrade_host() is costly (reads through many vectors) and redundant
because it repeats the behavior that should be handled by the greylist
refinery.

what we need is a way to avoid instantly reconnecting to hosts that we
have just failed to connect to.

this commit introduces a simple fix- we write to a vector called
`rejected` and avoid trying to reconnect to its entries once a
connection has failed.

however, this is not ideal as it means we will never connect to that
host- see TODO.
2024-01-14 16:00:54 +01:00
lunar-mining
fb4306e1e4 store: fix logic error in greylist_store_or_update
previously we were checking whether the entry is in any of the hostlists
(hostlist_contains) prior to storing entries in the greylist.

this creates a logic error which we have now fixed.

the impact is we will now likely have duplicate connections between the
greylist and other lists. however, it shouldn't be a problem.
2024-01-14 15:55:06 +01:00
lunar-mining
3abd2c62bb net: don't hide connection upgrade inside perform_handshake_protocols()
make a standalone function that removes the address from the white or
greylist and adds it to the anchorlist. call it inside outbound and
manual session.

this commit also removes a redundant Result<()> from
[hostlist]_store_or_upgrade() method and updates its usage.

We also add various debug statements and cleanup.
2024-01-14 11:42:01 +01:00
lunar-mining
f08ce9a4c8 chore: fix comment positionning on manual_session 2024-01-14 11:38:44 +01:00
lunar-mining
e40405a257 store: bug fix
fix accidental read from wrong hostlist
2024-01-14 09:54:44 +01:00
lunar-mining
b38a1267fb store: remove redundant else clauses 2024-01-14 09:14:51 +01:00
lunar-mining
3f51d80438 chore: fix test fixes 2024-01-13 13:32:35 +01:00
lunar-mining
765bd819b2 net: change unwrap() to expect() on hostlist queries 2024-01-13 12:25:04 +01:00
lunar-mining
40619581cd store: reduce LOC in hostlist queries and update usage.
also cleanup debug statements and warnings.
2024-01-13 11:34:38 +01:00
lunar-mining
639f1f72bf store: fix and simplify tests 2024-01-11 11:59:03 +01:00
lunar-mining
c7cf7d861d lilith: change no hostlist warning to fatal panic 2024-01-10 14:53:29 +01:00
lunar-mining
2dbaf413a0 protocol_seed: fix bool syntax 2024-01-10 09:44:27 +01:00
lunar-mining
736459aa51 chore: cleanup
fix warnings + debug statements
2024-01-10 08:49:29 +01:00
lunar-mining
96cad54d81 net: 99.9999% of the time it works 100% of the time
cleaned up refinery code and seem to have eliminated deadlocks...
2024-01-08 12:20:10 +01:00
lunar-mining
fcf5a87a28 net: fix deadlock (partial fix)
* don't fetch addresses with lock in a nested way- first fetch the
  address, then apply the locking checks

* delete blocking function get_active_connect_count. instead, just use
  slots rather that active connections to avoid deadlock on p2p channels.

TODO: there seems to be another deadlock that occurs more rarely. From
preliminary investigations, it doesn't seem to be related to p2p channels.
2024-01-07 12:50:04 +01:00
lunar-mining
4cde069c53 store: document and cleanup 2024-01-03 18:50:04 +01:00
lunar-mining
e472003b6d outbound_session: fetch_address() logic bug fix
we need to use else if rather than chaining if statements as it gets
confused and calls multiple fetch methods otherwise.
2024-01-03 18:00:23 +01:00
lunar-mining
0ac12ff19d store: add test_fetch_address() unit test 2024-01-03 17:59:56 +01:00
lunar-mining
79e9039b9b store: create test_fetch_anchorlist() unit test 2024-01-03 15:57:15 +01:00
lunar-mining
ad3675eb3c store: fix death loop
if we don't remove the greylist entry, keeps trying to connect to
it
2024-01-02 11:06:53 +01:00
lunar-mining
5f00598c12 outbound_session: remove peer from anchor or whitelist when try_connect fails 2024-01-01 13:47:03 +01:00
lunar-mining
27d1b3aa03 hosts: fix logic on anchorlist_fetch_with_schemes
if we don't have any hosts on the anchorlist, chose from the whitelist.
if we don't have any on the whitelist, chose from the greylist.

same principle for whitelist_fetch_with_schemes (each method has a
different selection priority)
2024-01-01 01:09:47 +01:00
lunar-mining
426efdf90b chore: cargo fmt 2023-12-31 11:49:55 +01:00
lunar-mining
18479be298 test: add seed node to net/test.rs 2023-12-31 11:48:48 +01:00
lunar-mining
1578138e8f outbound_session: move fetch_address logic into new function 2023-12-31 11:47:42 +01:00
lunar-mining
2696290aad store: fix logic on is_empty_hostlist()
anchorlist, greylist AND whitelist must be empty for this to return
true (previously OR)
2023-12-30 15:31:36 +01:00
lunar-mining
ca885a43ee store: improve error naming
Error::InvalidIndex -> Error::HostDoesNotExist
2023-12-30 12:05:47 +01:00
lunar-mining
07c2d667e1 session: remove redundant anchorlist write
We are already storing anchorlist entries in perform_handshake_protocols of session/mod.rs.
2023-12-30 11:58:26 +01:00
lunar-mining
4d4392f9e8 net: add test module to mod.rs 2023-12-30 11:45:27 +01:00
lunar-mining
873cd35e0e net: add hostlist documentation 2023-12-29 17:31:21 +01:00
lunar-mining
51b4263a93 net: remove connection from anchorlist when it disconnects and cleanup.
also remove perform_local_handshake function as it's made redudant by
the anchorlist removal change.
2023-12-29 17:31:03 +01:00
lunar-mining
a555f2e744 net: add anchor_connection_count and white_connect_percent to Settings and cleanup 2023-12-29 17:30:51 +01:00
lunar-mining
ca4d523dd3 net: remove unwrap()'s and cleanup 2023-12-29 17:30:38 +01:00
lunar-mining
6e8671d5b0 net: create greylist_refinery_interval in net::Settings and update TODOs 2023-12-29 17:30:29 +01:00
lunar-mining
995ff6f6c2 lilith: add hostlist path to NetInfo and default config 2023-12-29 17:29:26 +01:00
lunar-mining
d15cc3b2bd net: read hostlist path from Settings. Define a default setting and allow overriding in config 2023-12-29 17:28:39 +01:00
lunar-mining
b456d8f5ec lilith: remove load and save host functionality (made redundant by greylist upgrade) 2023-12-29 17:28:15 +01:00
lunar-mining
5be6a07c61 net: add save_hosts() and load_hosts() methods and invoke on greylist refinery start and stop 2023-12-29 17:28:04 +01:00
lunar-mining
03e6e99e90 net: move host selection logic back into hosts/store to avoid insane nesting in outbound session loop 2023-12-29 17:27:47 +01:00
lunar-mining
0096f778c6 net: improve outbound_session connection loop logic. 2023-12-29 17:27:34 +01:00
lunar-mining
6a39e926f1 net: prevent inbound session channels from being stored in the anchorlist 2023-12-29 17:26:54 +01:00
lunar-mining
c850f629b8 net: cleanup connect loop code reuse by implement connect_slot() method. also prevent infinite loop by doing peer discovery when the hostlist is empty.
also fix tests.
2023-12-29 17:26:44 +01:00
lunar-mining
b5bf749fe9 net: replace outbound connection loop with monero grey/white/anchor connection_maker()
see: ac02af9286/src/p2p/net_node.inl (L1807)

we have made connection_maker()mless nested and adapted it to the existing structure.

WARNING: UNTESTED
2023-12-29 17:26:33 +01:00
lunar-mining
03ae65956a net: add peer to the anchorlist with an updated last_seen when we call p2p.store() on a connected channel 2023-12-29 17:26:20 +01:00