Commit graph

407 commits

Author SHA1 Message Date
Luke Dashjr d5f46832de Unify package name to as few places as possible without major changes 2015-12-14 02:11:10 +00:00
Peter Todd 08843ed998 Add relaytxes status to getpeerinfo 2015-11-20 16:07:12 -08:00
Patick Strateman 71a2683f4b Use DEFAULT_BLOCKSONLY and DEFAULT_WHITELISTALWAYSRELAY constants 2015-11-14 05:10:59 -08:00
Patick Strateman 4044f07d1c Add blocksonly mode 2015-11-14 04:52:21 -08:00
MarcoFalke b27e81f115 [net] Cleanup maxuploadtarget
* 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-12 20:45:57 +01:00
Wladimir J. van der Laan 09c1ae1c01 torcontrol improvements and fixes
- 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-11-12 17:58:15 +01:00
Wladimir J. van der Laan 8f4e67f152 net: Automatically create hidden service, listen on Tor
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
API, to create and destroy 'ephemeral' hidden services programmatically.
https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service

This means that if Tor is running (and proper authorization is available),
bitcoin automatically creates a hidden service to listen on, without user
manual configuration. This will positively affect the number of available
.onion nodes.

- When the node is started, connect to Tor through control socket
- Send `ADD_ONION` command
- First time:
    - Make it create a hidden service key
    - Save the key in the data directory for later usage
- Make it redirect port 8333 to the local port 8333 (or whatever port we're listening on).
- Keep control socket connection open for as long node is running. The hidden service will
  (by default) automatically go away when the connection is closed.
2015-11-10 17:29:56 +01:00
Jonas Schnelli 872fee3fcc
Introduce -maxuploadtarget
* -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-10-26 15:37:30 +01:00
Gregory Maxwell a4e28b3d1e Set TCP_NODELAY on P2P sockets.
Nagle appears to be a significant contributor to latency now that the static
 sleeps are gone.  Most of our messages are relatively large compared to
 IP + TCP so I do not expect this to create enormous overhead.

This may also reduce traffic burstyness somewhat.
2015-10-22 17:57:48 +00:00
Wladimir J. van der Laan 93ff1b9041 net: correctly initialize nMinPingUsecTime
`nMinPingUsecTime` was left uninitialized in CNode.
The correct initialization for a minimum-until-now is int64_t's max value, so initialize it to that.
Thanks @MarcoFalke for noticing.
2015-09-04 16:27:38 +02:00
Matt Corallo a6eb4ba38b Report minimum ping time in getpeerinfo 2015-09-03 13:06:13 -07:00
Wladimir J. van der Laan 69dc5b51a0
Merge pull request #6374
027de94 Use network group instead of CNetAddr in final pass to select node to disconnect (Patrick Strateman)
000c18a Fix comment (Patrick Strateman)
fed3094 Acquire cs_vNodes before changing refrence counts (Patrick Strateman)
69ee1aa CNodeRef copy constructor and assignment operator (Patrick Strateman)
dc81dd0 Return false early if vEvictionCandidates is empty (Patrick Strateman)
17f3533 Better support for nodes with non-standard nMaxConnections (Patrick Strateman)
1317cd1 RAII wrapper for CNode* (Patrick Strateman)
df23937 Add comments to AttemptToEvictConnection (Patrick Strateman)
a8f6e45 Remove redundant whiteconnections option (Patrick Strateman)
b105ba3 Prefer to disconnect peers in favor of whitelisted peers (Patrick Strateman)
2c70153 AttemptToEvictConnection (Patrick Strateman)
4bac601 Record nMinPingUsecTime (Patrick Strateman)
ae037b7 Refactor: Move failure conditions to the top of AcceptConnection (Patrick Strateman)
1ef4817 Refactor: Bail early in AcceptConnection (Patrick Strateman)
541a1dd Refactor: AcceptConnection (Patrick Strateman)
2015-09-03 18:27:24 +02:00
Wladimir J. van der Laan af9305a7e8
Merge pull request #6583
9f3e48e add support for miniupnpc api version 14 (Pavel Vasin)
2015-08-31 17:38:07 +02:00
Patrick Strateman 027de94e1f
Use network group instead of CNetAddr in final pass to select node to disconnect 2015-08-30 22:09:14 -07:00
J Ross Nicoll 9bebf60698
Make sure LogPrint strings are line-terminated 2015-08-29 17:40:13 +01:00
Patrick Strateman 000c18aace Fix comment 2015-08-25 16:31:13 -07:00
Patrick Strateman fed30940ef Acquire cs_vNodes before changing refrence counts 2015-08-25 16:30:02 -07:00
Patrick Strateman 69ee1aab00 CNodeRef copy constructor and assignment operator 2015-08-25 15:33:29 -07:00
Cory Fields a19338723d net: Set SO_REUSEADDR for Windows too
When running the rpc tests in Wine, nodes often fail to listen on localhost
due to a stale socket from a previous run. This aligns the behavior with other
platforms.
2015-08-25 11:31:06 -04:00
Pavel Vasin 9f3e48e521 add support for miniupnpc api version 14
The value of new arg ttl is set to 2 as it's recommended default.
2015-08-23 23:53:49 +03:00
Patrick Strateman dc81dd02a1 Return false early if vEvictionCandidates is empty 2015-08-22 15:38:24 -07:00
Patrick Strateman 17f3533c84 Better support for nodes with non-standard nMaxConnections 2015-08-22 15:38:24 -07:00
Patrick Strateman 1317cd1928 RAII wrapper for CNode* 2015-08-22 15:38:24 -07:00
Patrick Strateman df23937422 Add comments to AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman a8f6e45249 Remove redundant whiteconnections option 2015-08-22 15:38:24 -07:00
Patrick Strateman b105ba398b Prefer to disconnect peers in favor of whitelisted peers 2015-08-22 15:38:24 -07:00
Patrick Strateman 2c701537c8 AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman ae037b707c Refactor: Move failure conditions to the top of AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 1ef4817614 Refactor: Bail early in AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 541a1dd9e6 Refactor: AcceptConnection 2015-08-22 15:38:23 -07:00
Veres Lajos 9f68ed6b6d typofixes (found by misspell_fixer) 2015-08-10 22:06:27 +01:00
Wladimir J. van der Laan c384800027
Merge pull request #6462
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-05 15:43:10 +02:00
Pavol Rusnak 7b79cbd722 limit total length of user agent comments
Reworked-By: Wladimir J. van der Laan <laanwj@gmail.com>
2015-08-05 09:38:20 +02:00
Matt Quinn 19dd40a25f Consolidate individual references to the current maximum peer connection
value of 125 into a single constant declaration.
2015-08-03 14:37:00 -07:00
Pavol Rusnak 557f8eac7a implement uacomment config parameter
which can add comments to user agent as per BIP-0014
2015-07-31 16:19:23 +02:00
Peter Todd d2d7ee0e86 Make CRollingBloomFilter set nTweak for you
While CBloomFilter is usually used with an explicitly set nTweak,
CRollingBloomFilter is only used internally. Requiring every caller to
set nTweak is error-prone and redundant; better to have the class handle
that for you with a high-quality randomness source.

Additionally when clearing the filter it makes sense to change nTweak as
well to recover from a bad setting, e.g. due to insufficient randomness
at initialization, so the clear() method is replaced by a reset() method
that sets a new, random, nTweak value.
2015-07-27 18:38:49 +02:00
Wladimir J. van der Laan ca37e0f339
Merge pull request #5697
60c8bac Includes: Cleanup around net main and wallet (Jorge Timón)
9dd793f TRIVIAL: Missing includes (Jorge Timón)
2015-07-27 14:40:29 +02:00
Jorge Timón 60c8bac77c Includes: Cleanup around net main and wallet
-Move from .h to .cpp: in main, net and wallet
-Remove unnecessary #include "main.h"
-Cleanup some wallet files includes
2015-07-23 21:10:26 +02:00
Wladimir J. van der Laan d2464dfee9
Merge pull request #6287
a794284 locking: add a quick example of GUARDED_BY (Cory Fields)
2b890dd locking: fix a few small issues uncovered by -Wthread-safety (Cory Fields)
cd27bba locking: teach Clang's -Wthread-safety to cope with our scoped lock macros (Cory Fields)
2015-07-23 18:45:26 +02:00
Pieter Wuille d422f9b1fd Test whether created sockets are select()able 2015-07-10 12:05:09 -04:00
Wladimir J. van der Laan 445220544e
Merge pull request #5288
e3cae52 Added -whiteconnections=<n> option (Josh Lehan)
2015-07-10 15:07:15 +02:00
Jonas Schnelli 177a0e4914 Adding CSubNet constructor over a single CNetAddr 2015-07-02 20:44:27 +02:00
Jonas Schnelli 409bccfbf5 use CBanEntry as object container for banned nodes
- added a reason enum for a ban
- added creation time for a ban

Using CBanEntry as container will keep banlist.dat extenable.
2015-07-02 20:29:36 +02:00
Jonas Schnelli dfa174c295 CAddrDB/CBanDB: change filesize variables from int to uint64_t 2015-07-02 20:29:36 +02:00
Jonas Schnelli f581d3d656 banlist.dat: store banlist on disk 2015-07-02 20:29:36 +02:00
Jonas Schnelli 62909f68a0 fix missing lock in CNode::ClearBanned() 2015-06-19 13:31:33 +02:00
Jonas Schnelli 4e36e9bcc7 setban: rewrite to UniValue, allow absolute bantime 2015-06-17 21:40:55 +02:00
Jonas Schnelli 433fb1a95d [RPC] extend setban to allow subnets 2015-06-17 21:40:55 +02:00
Jonas Schnelli e8b93473f1 [net] remove unused return type bool from CNode::Ban() 2015-06-17 21:40:55 +02:00
Jonas Schnelli 2252fb91cd [net] extend core functionallity for ban/unban/listban 2015-06-17 21:40:55 +02:00