aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
AgeCommit message (Collapse)Author
2016-01-05Bump copyright headers to 2015MarcoFalke
- Bump copyright headers to 2015 - [devtools] Rewrite fix-copyright-headers.py - [devtools] Use git pretty-format for year parsing Github-Pull: #7205 Rebased-From: fa6ad855e9159b2247da4fa0054f32fa181499ab fa24439ff3d8ab5b9efaf66ef4dae6713b88cb35 fa71669452e57039e4270fd2b33a0e0e1635b813
2015-12-14Replace trickle nodes with per-node/message Poisson delaysPieter Wuille
We used to have a trickle node, a node which was chosen in each iteration of the send loop that was privileged and allowed to send out queued up non-time critical messages. Since the removal of the fixed sleeps in the network code, this resulted in fast and attackable treatment of such broadcasts. This pull request changes the 3 remaining trickle use cases by random delays: * Local address broadcast (while also removing the the wiping of the seen filter) * Address relay * Inv relay (for transactions; blocks are always relayed immediately) The code is based on older commits by Patrick Strateman. Github-Pull: #7125 Rebased-From: 5400ef6bcb9d243b2b21697775aa6491115420f3
2015-12-04Replace setInventoryKnown with a rolling bloom filter.Gregory Maxwell
Github-Pull: #7133 Rebased-From: ec73ef37eccfeda76de55c4ff93ea54d4e69e1ec e20672479ef7f2048c2e27494397641d47a4d88d 6b849350ab074a7ccb80ecbef387f59e1271ded6 b6a0da45db8d534e7a77d1cebe382cd5d83ba9b8 d41e44c9accb3df84e0abbc602cc76b72754d382 aa4b0c26b0a94ca6164c441aae723e118554d214
2015-12-01Merge pull request #7079Wladimir J. van der Laan
ebb25f4 Limit setAskFor and retire requested entries only when a getdata returns. (Gregory Maxwell) 5029698 prevent peer flooding request queue for an inv (kazcw)
2015-11-29Allow block announcements with headersSuhas Daftuar
This replaces using inv messages to announce new blocks, when a peer requests (via the new "sendheaders" message) that blocks be announced with headers instead of inv's. Since headers-first was introduced, peers send getheaders messages in response to an inv, which requires generating a block locator that is large compared to the size of the header being requested, and requires an extra round-trip before a reorg can be relayed. Save time by tracking headers that a peer is likely to know about, and send a headers chain that would connect to a peer's known headers, unless the chain would be too big, in which case we revert to sending an inv instead. Based off of @sipa's commit to announce all blocks in a reorg via inv, which has been squashed into this commit. Rebased-by: Pieter Wuille
2015-11-28Constrain constant values to a single location in codeLuke Dashjr
2015-11-23Limit setAskFor and retire requested entries only when a getdata returns.Gregory Maxwell
The setAskFor duplicate elimination was too eager and removed entries when we still had no getdata response, allowing the peer to keep INVing and not responding.
2015-11-23prevent peer flooding request queue for an invkazcw
mapAlreadyAskedFor does not keep track of which peer has a request queued for a particular tx. As a result, a peer can blind a node to a tx indefinitely by sending many invs for the same tx, and then never replying to getdatas for it. Each inv received will be placed 2 minutes farther back in mapAlreadyAskedFor, so a short message containing 10 invs would render that tx unavailable for 20 minutes. This is fixed by disallowing a peer from having more than one entry for a particular inv in mapAlreadyAskedFor at a time.
2015-11-20Add relaytxes status to getpeerinfoPeter Todd
2015-11-14Fix fRelayTxs commentPatick Strateman
2015-11-14Add help text for blocksonly and whitelistalwaysrelayPatick Strateman
2015-11-12[net] Cleanup maxuploadtargetMarcoFalke
* log: nMaxOutboundLimit is in bytes * log: Hide misleading -maxuploadtarget=0 warning * qa : Minor cleanup to maxuploadtarget rpc tests * net: Use DEFAULT_MAX_UPLOAD_TARGET = 0
2015-11-12torcontrol improvements and fixesWladimir J. van der Laan
- Force AUTHCOOKIE size to be 32 bytes: This provides protection against an attack where a process pretends to be Tor and uses the cookie authentication method to nab arbitrary files such as the wallet - torcontrol logging - fix cookie auth - add HASHEDPASSWORD auth, fix fd leak when fwrite() fails - better error reporting when cookie file is not ok - better init/shutdown flow - stop advertizing service when disconnected from tor control port - COOKIE->SAFECOOKIE auth
2015-10-26Introduce -maxuploadtargetJonas Schnelli
* -maxuploadtarget can be set in MiB * if <limit> - ( time-left-in-24h-cycle / 600 * MAX_BLOCK_SIZE ) has reach, stop serve blocks older than one week and filtered blocks * no action if limit has reached, no guarantee that the target will not be surpassed * add outbound limit informations to rpc getnettotals
2015-09-03Report minimum ping time in getpeerinfoMatt Corallo
2015-08-22Remove redundant whiteconnections optionPatrick Strateman
2015-08-22Record nMinPingUsecTimePatrick Strateman
2015-08-10typofixes (found by misspell_fixer)Veres Lajos
2015-08-05Merge pull request #6462Wladimir J. van der Laan
7b79cbd limit total length of user agent comments (Pavol Rusnak) 557f8ea implement uacomment config parameter which can add comments to user agent as per BIP-0014 (Pavol Rusnak)
2015-08-05limit total length of user agent commentsPavol Rusnak
Reworked-By: Wladimir J. van der Laan <laanwj@gmail.com>
2015-08-03Consolidate individual references to the current maximum peer connectionMatt Quinn
value of 125 into a single constant declaration.
2015-07-23Includes: Cleanup around net main and walletJorge Timón
-Move from .h to .cpp: in main, net and wallet -Remove unnecessary #include "main.h" -Cleanup some wallet files includes
2015-07-10Merge pull request #5288Wladimir J. van der Laan
e3cae52 Added -whiteconnections=<n> option (Josh Lehan)
2015-07-02use CBanEntry as object container for banned nodesJonas Schnelli
- added a reason enum for a ban - added creation time for a ban Using CBanEntry as container will keep banlist.dat extenable.
2015-07-02banlist.dat: store banlist on diskJonas Schnelli
2015-06-17setban: rewrite to UniValue, allow absolute bantimeJonas Schnelli
2015-06-17[RPC] extend setban to allow subnetsJonas Schnelli
2015-06-17[net] remove unused return type bool from CNode::Ban()Jonas Schnelli
2015-06-17[net] extend core functionallity for ban/unban/listbanJonas Schnelli
2015-06-14Added -whiteconnections=<n> optionJosh Lehan
This sets aside a number of connection slots for whitelisted peers, useful for ensuring your local users and miners can always get in, even if your limit on inbound connections has already been reached.
2015-06-04use const references where appropriatePhilip Kaufmann
2015-05-14Use CScheduler for net's DumpAddressesGavin Andresen
Instead of starting Yet Another Thread to dump addresses, use CScheduler to do it.
2015-05-04Merge pull request #6085Wladimir J. van der Laan
b05a89b Non-grammatical language improvements (Luke Dashjr) 7e6d23b Bugfix: Grammar fixes (Corinne Dashjr)
2015-05-01Bugfix: Grammar fixesCorinne Dashjr
2015-04-30Replace mruset setAddrKnown with CRollingBloomFilter addrKnownGavin Andresen
Use a probabilistic bloom filter to keep track of which addresses we think we have given our peers, instead of a list. This uses much less memory, at the cost of sometimes failing to relay an address to a peer-- worst case if the bloom filter happens to be as full as it gets, 1-in-1,000. Measured memory usage of a full mruset setAddrKnown: 650Kbytes Constant memory usage of CRollingBloomFilter addrKnown: 37Kbytes. This will also help heap fragmentation, because the 37K of storage is allocated when a CNode is created (when a connection to a peer is established) and then there is no per-item-remembered memory allocation. I plan on testing by restarting a full node with an empty peers.dat, running a while with -debug=addrman and -debug=net, and making sure that the 'addr' message traffic out is reasonable. (suggestions for better tests welcome)
2015-03-12Merge pull request #5859Wladimir J. van der Laan
9519a9a Add correct bool combiner for net signals (Pieter Wuille)
2015-03-07Merge pull request #5151Pieter Wuille
eec3713 make CMessageHeader a dumb storage class (Cory Fields)
2015-03-06Limit message sizes before transferPieter Wuille
This introduces a fixed limit for the size of p2p messages, and enforces it before download.
2015-03-06Add correct bool combiner for net signalsPieter Wuille
2015-02-26Remove obsolete pubsub method definitionsPieter Wuille
2015-02-25make CMessageHeader a dumb storage classCory Fields
It shouldn't know or care about bitcoind's chain param selection
2015-01-20Delete RecvLine functionWladimir J. van der Laan
No longer necessary since #5161 / 845c86d128fb97d55d125e63653def38729bd2ed.
2015-01-02Merge pull request #5476Wladimir J. van der Laan
73caf47 Display time offset in the debug window's Peers tab (Pavel Janík) 26a6bae Add time offset to getpeerinfo output (Pavel Janík)
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-16Remove references to X11 licenceMichael Ford
2014-12-15Add time offset to getpeerinfo outputPavel Janík
2014-12-04Limit the number of new addressses to accumulatePieter Wuille
2014-11-07Do not use third party services for IP detection.Gregory Maxwell
This is a simplified re-do of closed pull #3088. This patch eliminates the privacy and reliability problematic use of centralized web services for discovering the node's addresses for advertisement. The Bitcoin protocol already allows your peers to tell you what IP they think you have, but this data isn't trustworthy since they could lie. So the challenge is using it without creating a DOS vector. To accomplish this we adopt an approach similar to the one used by P2Pool: If we're announcing and don't have a better address discovered (e.g. via UPNP) or configured we just announce to each peer the address that peer told us. Since peers could already replace, forge, or drop our address messages this cannot create a new vulnerability... but if even one of our peers is giving us a good address we'll eventually make a useful advertisement. We also may randomly use the peer-provided address for the daily rebroadcast even if we otherwise have a seemingly routable address, just in case we've been misconfigured (e.g. by UPNP). To avoid privacy problems, we only do these things if discovery is enabled.
2014-10-22boost: split stream classes out of serialize.hCory Fields
serialization now has no dependencies.
2014-10-14Headers-first synchronizationPieter Wuille
Many changes: * Do not use 'getblocks', but 'getheaders', and use it to build a headers tree. * Blocks are fetched in parallel from all available outbound peers, using a limited moving window. When one peer stalls the movement of the window, it is disconnected. * No more orphan blocks. At all. We only ever request a block for which we have verified the headers, and store it to disk immediately. This means that a disk-fill attack would require PoW. * Require protocol version 31800 for every peer (released in december 2010). * No more syncnode (we sync from everyone we can, though limited to 1 during initial *headers* sync). * Introduce some extra named constants, comments and asserts.