Commit graph

11519 commits

Author SHA1 Message Date
Jeremy Rubin d1a2295f0d Made the ForEachNode* functions in src/net.cpp more pragmatic and self documenting 2016-09-08 13:06:05 -04:00
Cory Fields 98591c5027 net: move vNodesDisconnected into CConnman 2016-09-08 13:06:05 -04:00
Cory Fields fa2f8bc47f net: add nSendBufferMaxSize/nReceiveFloodSize to CConnection::Options 2016-09-08 13:06:00 -04:00
Cory Fields a19553b992 net: Introduce CConnection::Options to avoid passing so many params 2016-09-08 13:04:29 -04:00
Cory Fields bafa5fc5a1 net: Drop StartNode/StopNode and use CConnman directly 2016-09-08 12:24:07 -04:00
Cory Fields e81a602cf0 net: pass CClientUIInterface into CConnman 2016-09-08 12:24:07 -04:00
Cory Fields f60b9059e4 net: Pass best block known height into CConnman
CConnman then passes the current best height into CNode at creation time.

This way CConnman/CNode have no dependency on main for height, and the signals
only move in one direction.

This also helps to prevent identity leakage a tiny bit. Before this change, an
attacker could theoretically make 2 connections on different interfaces. They
would connect fully on one, and only establish the initial connection on the
other. Once they receive a new block, they would relay it to your first
connection, and immediately commence the version handshake on the second. Since
the new block height is reflected immediately, they could attempt to learn
whether the two connections were correlated.

This is, of course, incredibly unlikely to work due to the small timings
involved and receipt from other senders. But it doesn't hurt to lock-in
nBestHeight at the time of connection, rather than letting the remote choose
the time.
2016-09-08 12:24:06 -04:00
Cory Fields fdf69ff21a net: move max/max-outbound to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields 8a593694b1 net: move semOutbound to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields bd72937dc4 net: move nLocalServices/nRelevantServices to CConnman
These are in-turn passed to CNode at connection time. This allows us to offer
different services to different peers (or test the effects of doing so).
2016-09-08 12:24:06 -04:00
Cory Fields be9c796dc5 net: move SendBufferSize/ReceiveFloodSize to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields 63cafa6329 net: move send/recv statistics to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields adf5d4c2e4 net: SocketSendData returns written size 2016-09-08 12:24:06 -04:00
Cory Fields ee44fa9576 net: move messageHandlerCondition to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields 960cf2e405 net: move nLocalHostNonce to CConnman
This behavior seems to have been quite racy and broken.

Move nLocalHostNonce into CNode, and check received nonces against all
non-fully-connected nodes. If there's a match, assume we've connected
to ourself.
2016-09-08 12:24:06 -04:00
Cory Fields 551e0887db net: move nLastNodeId to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields 6c19d92361 net: move whitelist functions into CConnman 2016-09-08 12:24:06 -04:00
Cory Fields 53347f0cb9 net: create generic functor accessors and move vNodes to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields c0569c7fa1 net: Add most functions needed for vNodes to CConnman 2016-09-08 12:12:58 -04:00
Cory Fields 8ae2dac1c6 net: move added node functions to CConnman 2016-09-08 12:12:58 -04:00
Cory Fields 502dd3a8a0 net: Add oneshot functions to CConnman 2016-09-08 12:12:57 -04:00
Cory Fields a0f3d3cdad net: move ban and addrman functions into CConnman 2016-09-08 12:12:57 -04:00
Cory Fields aaf018e3b7 net: handle nodesignals in CConnman 2016-09-08 12:06:24 -04:00
Cory Fields b1a5f43208 net: move OpenNetworkConnection into CConnman 2016-09-08 12:06:24 -04:00
Cory Fields 02137f11e2 net: Move socket binding into CConnman 2016-09-08 12:06:24 -04:00
Cory Fields 5b446dd5b1 net: Pass CConnection to wallet rather than using the global 2016-09-08 12:04:35 -04:00
Cory Fields 8d58c4d81f net: Pass CConnman around as needed 2016-09-08 12:04:35 -04:00
Cory Fields d7349ca50d net: Add rpc error for missing/disabled p2p functionality 2016-09-08 12:04:35 -04:00
Cory Fields cd16f48028 net: Create CConnman to encapsulate p2p connections 2016-09-08 12:04:35 -04:00
Cory Fields d93b14dc5d net: move CBanDB and CAddrDB out of net.h/cpp
This will eventually solve a circular dependency
2016-09-08 12:03:22 -04:00
Cory Fields 531214fb10 gui: add NodeID to the peer table 2016-09-08 12:03:22 -04:00
MarcoFalke ddc308068d
Merge #8671: Minimal fix to slow prevector tests as stopgap measure
f71d4a3 Minimal fix to slow prevector tests as stopgap measure (Jeremy Rubin)
2016-09-08 11:12:50 +02:00
MarcoFalke ec139a5621
Merge #8673: Trivial: Fix obvious assignment/equality error in test
426e7bc Fix obvious assignment/equality error in test (Jeremy Rubin)
2016-09-07 19:36:43 +02:00
Pieter Wuille 5b2ea29cf4
Merge #8594: Do not add random inbound peers to addrman.
eb3596f Do not add random inbound peers to addrman. (Gregory Maxwell)
2016-09-07 13:19:53 +02:00
Pieter Wuille e2a1a1ee89
Merge #8606: Fix some locks
144ed76 Fix some locks (Pieter Wuille)
2016-09-07 13:10:10 +02:00
Jeremy Rubin 426e7bce0e Fix obvious assignment/equality error in test 2016-09-06 16:22:13 -04:00
Jeremy Rubin f71d4a3786 Minimal fix to slow prevector tests as stopgap measure 2016-09-06 16:19:25 -04:00
Wladimir J. van der Laan 8ea44405e7
Merge #8645: Remove unused Qt 4.6 patch.
38acbf8 Remove unused Qt 4.6 patch. (Doug)
2016-09-06 15:23:51 +02:00
Wladimir J. van der Laan d077f43f7e
Merge #8663: trivial: remove unnecessary variable fDaemon
ff2ed7a trivial: remove unnecessary variable fDaemon (mruddy)
2016-09-06 15:20:08 +02:00
Pieter Wuille e82fb872ff
Merge #8651: Predeclare PrecomputedTransactionData as struct
4424af5 Predeclare PrecomputedTransactionData as sturct (Pieter Wuille)
2016-09-05 13:30:09 +02:00
mruddy ff2ed7a5bc trivial: remove unnecessary variable fDaemon 2016-09-04 11:42:07 -04:00
Wladimir J. van der Laan cbe9ae8c69
Merge #8466: [Trivial] Do not shadow variables in networking code
b7c349d Do not shadow variables in networking code (Pavel Janík)
2016-09-02 12:51:56 +02:00
Wladimir J. van der Laan 381d0ddc8a
Merge #8449: [Trivial] Do not shadow local variable, cleanup
a159f25 Remove redundand (and shadowing) declaration (Pavel Janík)
cce3024 Do not shadow local variable, cleanup (Pavel Janík)
2016-09-02 12:25:59 +02:00
Pieter Wuille 4424af5190 Predeclare PrecomputedTransactionData as sturct 2016-09-02 11:43:06 +02:00
Wladimir J. van der Laan 6f939c9080
Merge #8629: C++11: s/boost::scoped_ptr/std::unique_ptr/
cdd79eb C++11: s/boost::scoped_ptr/std::unique_ptr/ (Jorge Timón)
2016-09-02 09:56:33 +02:00
Wladimir J. van der Laan 91990ee01d
Merge #8272: Make the dummy argument to getaddednodeinfo optional
854f1af Make the dummy argument to getaddednodeinfo optional (Pieter Wuille)
2016-09-02 07:50:42 +02:00
Doug 38acbf83e1 Remove unused Qt 4.6 patch.
Core no longer supports Qt 4. Therefore, the STL fix patch isn't needed.
2016-09-01 17:20:44 -07:00
Jorge Timón cdd79eb70f C++11: s/boost::scoped_ptr/std::unique_ptr/ 2016-09-01 19:05:07 +02:00
Pieter Wuille 854f1af22e Make the dummy argument to getaddednodeinfo optional 2016-09-01 16:27:30 +02:00
Wladimir J. van der Laan f061415d12
Merge #8638: rest.cpp: change HTTP_INTERNAL_SERVER_ERROR to HTTP_BAD_REQUEST
f012a85 rest.cpp: change HTTP_INTERNAL_SERVER_ERROR to HTTP_BAD_REQUEST (djpnewton)
2016-09-01 15:58:43 +02:00