Commit Graph

10719 Commits

Author SHA1 Message Date
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
Pieter Wuille
d4e4acd906 Optimize the relay map to use shared_ptr's 2018-10-17 20:51:23 +03:00
lateminer
ea21ee91da Fix typo
txmempool.h
2018-10-17 20:36:32 +03:00
Pieter Wuille
5e9497ce5b Add support for unique_ptr and shared_ptr to memusage 2018-10-17 20:34:57 +03:00
Pieter Wuille
ab86d7e4ff Switch CTransaction storage in mempool to std::shared_ptr 2018-10-17 20:34:25 +03:00
Suhas Daftuar
0814da4e9d Only use AddInventoryKnown for transactions
filterInventoryKnown is only used when relaying transactions,
so stop adding block hashes to the filter.
2018-10-17 20:32:50 +03:00
Gregory Maxwell
b3992a38d4 Defer inserting into maprelay until just before relaying. 2018-10-17 20:32:14 +03:00
Wladimir J. van der Laan
c41e3c69aa UpdateTip: log only one line at most per block 2018-10-17 20:26:54 +03:00
Gregory Maxwell
89655c3a1e Remove unneeded feerate param from RelayTransaction/AcceptToMemoryPool. 2018-10-17 20:22:44 +03:00
Gregory Maxwell
16b0e12385 Do not use mempool for GETDATA for tx accepted after the last mempoolreq 2018-10-17 19:56:28 +03:00
Gregory Maxwell
c41eb3a831 Move bloom and feerate filtering to just prior to tx sending. 2018-10-17 19:47:32 +03:00
Pieter Wuille
80803b1de0 Return mempool queries in dependency order 2018-10-17 19:45:54 +03:00
Pieter Wuille
eeded98dce Handle mempool requests in send loop, subject to trickle
By eliminating queued entries from the mempool response and responding only at
trickle time, this makes the mempool no longer leak transaction arrival order
information (as the mempool itself is also sorted)-- at least no more than
relay itself leaks it.
2018-10-17 19:45:45 +03:00
Pieter Wuille
16e9766115 Split up and optimize transaction and block inv queues 2018-10-17 19:45:37 +03:00
Daniel Kraft
ad0ec643b7 [trivial] Add missing const qualifiers.
Add some const qualifiers to references that are not modified and should
be marked as const.
2018-10-17 19:44:48 +03:00
Gregory Maxwell
05c3d2e290 Eliminate TX trickle bypass, sort TX invs for privacy and priority.
Previously Bitcoin would send 1/4 of transactions out to all peers
 instantly.  This causes high overhead because it makes >80% of
 INVs size 1.  Doing so harms privacy, because it limits the
 amount of source obscurity a transaction can receive.

These randomized broadcasts also disobeyed transaction dependencies
 and required use of the orphan pool.  Because the orphan pool is
 so small this leads to poor propagation for dependent transactions.

When the bypass wasn't in effect, transactions were sent in the
 order they were received.  This avoided creating orphans but
 undermines privacy fairly significantly.

This commit:
 Eliminates the bypass. The bypass is replaced by halving the
  average delay for outbound peers.

 Sorts candidate transactions for INV by their topological
  depth then by their feerate (then hash); removing the
  information leakage and providing priority service to
  higher fee transactions.

 Limits the amount of transactions sent in a single INV to
  7tx/sec (and twice that for outbound); this limits the
  harm of low fee transaction floods, gives faster relay
  service to higher fee transactions. The 7 sounds lower
  than it really is because received advertisements need
  not be sent, and because the aggregate rate is multipled
  by the number of peers.
2018-10-17 19:44:11 +03:00
Matt Corallo
705fe53e49 Fix some minor compact block issues that came up in review 2018-10-17 19:24:21 +03:00
Matt Corallo
49c0e28d70 Use vTxHashes to optimize InitData significantly 2018-10-17 19:24:13 +03:00
Pieter Wuille
346175e76c Elaborate bucket size math 2018-10-17 19:24:06 +03:00
Matt Corallo
b88d342f2c Provide a flat list of txid/terators to txn in CTxMemPool 2018-10-17 19:23:57 +03:00
Matt Corallo
3f6cddb53e Add reconstruction debug logging 2018-10-17 19:23:44 +03:00
Matt Corallo
4e55d9962c Get our "best three" peers to announce blocks using cmpctblocks 2018-10-17 19:23:07 +03:00
Matt Corallo
1ce3308431 Add ability to fetch CNode by NodeId 2018-10-17 19:22:59 +03:00
Matt Corallo
0fcad61796 Add receiver-side protocol implementation for CMPCTBLOCK stuff 2018-10-17 19:20:33 +03:00