Commit Graph

10742 Commits

Author SHA1 Message Date
Cory Fields
d50d2bbded net: resolve outside of storage structures
Rather than allowing CNetAddr/CService/CSubNet to launch DNS queries, require
that addresses are already resolved.

This greatly simplifies async resolve logic, and makes it harder to
accidentally leak DNS queries.
2018-10-18 22:46:54 +03:00
Luke Dashjr
ef6e708ded Combine common error strings for different options so translations can be shared and reused 2018-10-18 22:46:39 +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
Ethan Heilman
4661755f32 Increase test coverage for addrman and addrinfo 2018-10-18 22:29:10 +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
Pieter Wuille
f1d80ea69b Keep addrman's nService bits consistent with outbound observations 2018-10-18 22:26:08 +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
Wladimir J. van der Laan
0c6f5bd006 test: Add more test vectors for siphash
Add full test vectors from spec, test per byte and per 8 bytes.

Builds on #8086.
2018-10-18 21:56:12 +03:00
Pieter Wuille
bcac49d880 Support SipHash with arbitrary byte writes 2018-10-18 21:55:46 +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
Cory Fields
91584b2ab0 net: don't import std namespace 2018-10-18 21:38:57 +03:00
Kaz Wesley
d8ebc0d4fc fix race that could fail to persist a ban 2018-10-18 21:36:45 +03:00
EthanHeilman
51c23024eb Fix de-serialization bug where AddrMan is corrupted after exception 2018-10-18 21:32:13 +03:00
Gregory Maxwell
350a2d9b50 More comments on the design of AttemptToEvictConnection.
Some developers clearly don't get this and have been posting
 "improvements" that create clear vulnerabilities.  It should
 have been better explained in the code, since the design
 is somewhat subtle and getting it right is important.
2018-10-18 21:23:43 +03:00
lateminer
b6a9d6dba7 Comment connectionsControl for now 2018-10-17 22:29:26 +03:00
Cory Fields
6c6ed197af net: manually resolve dns seed sources
Note: Some seeds aren't actually returning an IP for their name entries, so
they're being added to addrman with a source of [::].

This commit shouldn't change that behavior, for better or worse.
2018-10-17 22:17:45 +03:00
Cory Fields
52147e1b80 net: require lookup functions to specify all arguments
To make it clear where DNS resolves are happening
2018-10-17 22:17:28 +03:00
Gregory Maxwell
e577b5c7e1 Only send one GetAddr response per connection. 2018-10-17 22:14:44 +03:00
Chris Wheeler
ea8bac6c36 Typo fixes in comments 2018-10-17 22:12:07 +03:00
21E14
fcc23c5c63 Double semicolon cleanup. 2018-10-17 22:10:51 +03:00
Wladimir J. van der Laan
b72d6e77e8 qt: Prevent thread/memory leak on exiting RPCConsole 2018-10-17 22:06:34 +03:00
Wladimir J. van der Laan
e059dd192b [Qt] Clean up and fix coincontrol tree widget handling
- Do sorting for date, amount and confirmations column as longlong, not
  unsigned longlong.
- Use `UserRole` to store our own data. This makes it treated as
  ancillary data prevents it from being displayed.
- Get rid of `getMappedColumn` `strPad` - these are no longer necessary.
- Get rid of hidden `_INT64` columns.
- Start enumeration from 0 (otherwise values are undefined).
2018-10-17 21:56:26 +03:00
Jonas Schnelli
ce51b7401d [Qt] fix coincontrol sort issue 2018-10-17 21:56:15 +03:00
lateminer
786436baef Make it compile 2018-10-17 21:37:53 +03:00
Pieter Wuille
834db9539b Get rid of CTxMempool::lookup() entirely 2018-10-17 20:51:51 +03:00
Pieter Wuille
2737ac3d7f Optimization: use usec in expiration and reuse nNow 2018-10-17 20:51:42 +03:00
Pieter Wuille
594213c60d Optimization: don't check the mempool at all if no mempool req ever 2018-10-17 20:51:33 +03:00