Commit Graph

580 Commits

Author SHA1 Message Date
Cory Fields
a9357f0c67 gui: fix ban from qt console 2019-03-09 12:36:26 +03:00
Cory Fields
6bd4b3a153 net: move CBanDB and CAddrDB out of net.h/cpp
This will eventually solve a circular dependency
2018-12-02 01:33:02 +03:00
lateminer
55729c2f6e Update to Core 0.13.2 2018-11-14 19:43:28 +03:00
lateminer
635495ba38 Use CNetAddr() instead of "0.0.0.0"
net.cpp
2018-10-22 22:47:28 +03:00
Alex Morcos
16047baaf6 Populate services in GetLocalAddress 2018-10-22 22:12:31 +03:00
Jonas Schnelli
c4881c72b5 Remove maxuploadtargets recommended minimum 2018-10-22 22:09:35 +03:00
lateminer
b1dc200c9d net: No longer send local address in addrMe 2018-10-22 22:07:57 +03:00
lateminer
1874993043 Fix multiple backporting errors 2018-10-19 00:54:22 +03:00
Gregory Maxwell
8bbe525e02 Use RelevantServices instead of node_network in AttemptToEvict.
Use of node_network here is really meant to be a proxy of "likely to
 send us blocks in the future".  RelevantServices is the right criteria
 now.

Github-Pull: #9052
Rebased-From: d32036a47d9ccdc38628a7a75bb8b711af462e4f
2018-10-18 23:33:16 +03:00
MarcoFalke
5ef877ba8f [net] Remove assert(nMaxInbound > 0)
nMaxInbound might very well be 0 or -1, if the user prefers to keep
a small number of maxconnections.

Note: nMaxInbound of -1 means that the user set maxconnections
to 8 or less, but we still want to keep an additional slot for
the feeler connection.

Github-Pull: #9008
Rebased-From: fa1c3c2eb0a1853ed0e0662fc2bdbca51e05ccf5
2018-10-18 23:32:56 +03:00
Wladimir J. van der Laan
a14ed45674 nMaxOutbound is MAX_OUTBOUND_CONNECTIONS on 0.13
Github-Pull: #8949
2018-10-18 23:32:46 +03:00
Gregory Maxwell
7b0cd213fc Make dnsseed's definition of acute need include relevant services.
We normally prefer to connect to peers offering the relevant services.

If we're not connected to enough peers with relevant services, we
 probably don't know about them and could use dnsseed's help.

Github-Pull: #8949
Rebased-From: 46304791353d2bb61004a035869612620c30b4eb
2018-10-18 23:32:37 +03:00
Gregory Maxwell
784ceae891 Be more aggressive in connecting to peers with relevant services.
Only allow skipping relevant services until there are four outbound
 connections up.

This avoids quickly filling up with peers lacking the relevant
 services when addrman has few or none of them.

Github-Pull: #8949
Rebased-From: 9583477288072e203541b747fcffe8d50cfefb8d
2018-10-18 23:32:28 +03:00
Matt Corallo
a72b866b00 Remove bogus assert on number of oubound connections.
This value can be significantly higher if the users uses addnode

Github-Pull: #8944
Rebased-From: 1ab21cf344ed0547de5ae679b7e479cb4b1a923b
2018-10-18 23:32:18 +03:00
Matt Corallo
4faf4c99f7 Comment that most dnsseeds only support some service bits combos 2018-10-18 23:32:08 +03:00
leijurv
e0e706c9cf various typos 2018-10-18 23:30:54 +03:00
Ethan Heilman
82072c13f8 Added feeler connections increasing good addrs in the tried table. 2018-10-18 23:26:46 +03:00
Cory Fields
84a208b9d2 net: Have LookupNumeric return a CService directly 2018-10-18 23:10:38 +03:00
Pieter Wuille
4b61ea916b Update banning functions from Core 0.13 2018-10-18 23:03:54 +03:00
Cory Fields
620e64b25f net: narrow include scope after moving to netaddress 2018-10-18 22:56:46 +03:00
Cory Fields
4de79a2a14 net: Split resolving out of CService 2018-10-18 22:55:26 +03:00
Cory Fields
e5dba2d293 net: Split resolving out of CNetAddr 2018-10-18 22:55:14 +03:00
Pieter Wuille
fbc3049bd3 Add extra message to avoid a long 'Loading banlist' 2018-10-18 22:52:55 +03:00
Gregory Maxwell
4b310cec5d Allow disconnecting a netgroup with only one member in eviction.
With the latest additions there are enough protective measures that
 we can take the training wheels off.
2018-10-18 22:36:01 +03:00
Gregory Maxwell
35c0e679b7 Add recently accepted blocks and txn to AttemptToEvictConnection.
This protects any not-already-protected peers who were the most
 recent four to relay transactions and most recent four to send
 blocks to us.
2018-10-18 22:35:51 +03:00
Pieter Wuille
8f3520e4c5 Do not set extra flags for unfiltered DNS seed results 2018-10-18 22:35:42 +03:00
Pieter Wuille
098b500849 Prevent duplicate connections where one is by name and another by ip 2018-10-18 22:34:08 +03:00
Pieter Wuille
0fc3b89fa1 Rework addnode behaviour 2018-10-18 22:33:58 +03:00
Pieter Wuille
cb47af78cc Introduce REQUIRED_SERVICES constant 2018-10-18 22:32:31 +03:00
Pieter Wuille
c043d2fedc Introduce enum ServiceFlags for service flags 2018-10-18 22:32:23 +03:00
Pieter Wuille
645f26f52b Don't require services in -addnode 2018-10-18 22:29:19 +03:00
Pieter Wuille
be365a0d15 Only store and connect to NODE_NETWORK nodes 2018-10-18 22:26:29 +03:00
Pieter Wuille
0c7d5a8af8 Verify that outbound connections have expected services 2018-10-18 22:26:18 +03:00
Wladimir J. van der Laan
1ee8436348 net: Add and document network messages in protocol.h 2018-10-18 22:21:11 +03:00
Wladimir J. van der Laan
0b00741a03 net: Account for sendheaders verack messages
Looks like these were forgotten in #6589.
2018-10-18 22:11:02 +03:00
Jonas Schnelli
68a0b905a7 log bytes recv/sent per command 2018-10-18 22:10:46 +03:00
instagibbs
6a4c64355e rename mapAddrCount to mapNetGroupNodes 2018-10-18 21:56:35 +03:00
Pieter Wuille
3a1602b31d Use C++11 thread-safe static initializers 2018-10-18 21:55:20 +03:00
Pieter Wuille
a1d4facb14 Use 64-bit SipHash of netgroups in eviction 2018-10-18 21:55:11 +03:00
Patrick Strateman
02cfe3c9e8 Avoid recalculating vchKeyedNetGroup in eviction logic. 2018-10-18 21:53:52 +03:00
Pieter Wuille
f0d583e847 Use global ::fRelayTxes instead of CNode one 2018-10-18 21:49:32 +03:00
Gregory Maxwell
798fb2f972 Do not increment nAttempts by more than one for every Good connection.
This slows the increase of the nAttempts in addrman while partitioned,
 even if the node hasn't yet noticed the partitioning.
2018-10-18 21:49:17 +03:00
Gregory Maxwell
d3002718b5 Avoid counting failed connect attempts when probably offline. 2018-10-18 21:49:09 +03:00
Jonas Schnelli
0dd7c98e63 Add support for dnsseeds with option to filter by servicebits 2018-10-18 21:44:19 +03:00
Cory Fields
be75754cd7 net: No need to export DumpBanlist 2018-10-18 21:39:54 +03:00
Cory Fields
48f9c0e8b4 net: make Ban/Unban/ClearBan functionality consistent
- Ban/Unban/ClearBan call uiInterface.BannedListChanged() as necessary
- Ban/Unban/ClearBan sync to disk if the operation is user-invoked
- Mark node for disconnection automatically when banning
- Lock cs_vNodes while setting disconnected
- Don't spin in a tight loop while setting disconnected
2018-10-18 21:39:45 +03:00
Kaz Wesley
e8222a467f don't run ThreadMessageHandler at lowered priority
There's no clear reason ThreadMessageHandler should be low priority.
Fixes #8010 (priority inversion).
2018-10-18 21:39:36 +03:00
Cory Fields
5c11a7c29b net: Drop CNodeRef for AttemptToEvictConnection
Locking for each operation here is unnecessary, and solves the wrong problem.
Additionally, it introduces a problem when cs_vNodes is held in an owning
class, to which invididual CNodeRefs won't have access.

These should be weak pointers anyway, once vNodes contain shared pointers.

Rather than using a refcounting class, use a 3-step process instead.

1. Lock vNodes long enough to snapshot the fields necessary for comparing
2. Unlock and do the comparison
3. Re-lock and mark the resulting node for disconnection if it still exists
2018-10-18 21:39:27 +03:00
Cory Fields
9d1831b929 net: use the exposed GetNodeSignals() rather than g_signals directly 2018-10-18 21:39:17 +03:00
Cory Fields
e70188eb93 net: remove unused set 2018-10-18 21:39:08 +03:00