Commit graph

333 commits

Author SHA1 Message Date
Dave Collins
83407ade61 Rework block fetching code.
This commit significantly reworks the fetching code to interop better with
bitcoind.  In particular, when an inventory message is sent, and the
remote peer requests the final block, the remote peer sends the current
end of the main chain to signal that there are more blocks to get.

Previously this code was automatically requesting more blocks when the
number of in-flight blocks was under a certain threshold.  The original
approach does help alleviate delays in the "request final, wait for
orphan, request more" round trip, but due to the aforementioned mechanism,
it leads to double requests and other subtle issues.
2013-08-30 13:04:50 -05:00
Dave Collins
f7387f217a Remove current directory config autoload override.
This was a holder from before there was home directory based config.  The
user can use -C ./btcd.conf if that is the intended goal.
2013-08-19 14:48:46 -05:00
Dave Collins
6acd51f4b4 Only advertise local addr to peers when listenting.
Do not advertise the local address to outbound peers when we aren't
listening and therefore able to accept connections.
2013-08-17 15:26:51 -05:00
Dave Collins
627959adff Ignore config file addpeer entries with --regtest.
When running in regression test mode, it is unlikely the user wants to
connect to permanent peers they have configured in their config file.
This commit modifies the code to ignore the config file entry when in
regression test mode.  The user can still provide -a (or --addpeer) on the
command line to override this if they really want to connect out to a
specific peer during regression test mode.
2013-08-17 14:44:43 -05:00
Dave Collins
60779ea8df Add message blocking semantics to block processing.
This commit modifies the input message handler so that when a remote peer
sends a block, no further messages from that peer are accepted until the
block has been fully processed and therefore known good or bad.  This
helps prevent a malicious peer from queueing up a bunch of bad blocks
before disconnecting (or being disconnected) and wasting memory.

Additionally, this behavior is depended on by at least the block
acceptance test tool as the reference implementation processes blocks in
the same thread and therefore blocks further messages until the block has
been fully processed as well.
2013-08-16 13:40:05 -05:00
Dave Collins
2570ecd2ac Move log closure code into its own file. 2013-08-10 20:07:37 -05:00
Dave Collins
f269ad2ff4 Comment the logClosure code. 2013-08-09 16:02:47 -05:00
Dave Collins
8634a2fa01 Refactor peer disconnect code into single func. 2013-08-09 15:57:13 -05:00
John C. Vernaleo
00cd730c3f Add stop command to rpcserver. 2013-08-09 16:20:06 -04:00
Dave Collins
a3531957f4 Rework server startup and shutdown sequence.
The commit reworks the server statup and shutdown sequence to ensure the
server can always shutdown cleanly.  The peer code depends on being able
to send messages to the address and block managers, so they need to have
their lifecycle tied to the peer handler to prevent issues with
asynchronous shutdown order.
2013-08-09 14:43:30 -05:00
Dave Collins
f80bc8c8f9 Misc comment and doco cleanup. 2013-08-08 12:47:15 -05:00
David Hill
52416ec28f new option --tor (requires --proxy)
Although not required if the proxy set is indeed Tor, setting this option
does the following:
   - Sends DNS queries over the Tor network (during dns seed lookup).  This
     stops your IP from being leaked via DNS.
   - Does not disable the listening port.  This allows the hidden services
     feature of Tor to be used.
2013-08-08 12:11:39 -04:00
Dave Collins
41910c0944 Import needed package. 2013-08-08 10:11:03 -05:00
Dave Collins
1fecbec3df Move userAgent to peer where it's used. 2013-08-08 09:26:18 -05:00
Dave Collins
48d3c5f585 Make user agent use the app version constants. 2013-08-08 09:12:40 -05:00
Dave Collins
eab9c1f0c1 Insert genesis block if needed on db load.
Previously, the genesis block was only inserted when the database was
created, but it's possible due to rollback that the database is created
and the genesis block insert gets rolled back if the app is existed too
quickly.  This commit modifies the logic to test the need for the genesis
block any time the database is loaded and insert it if necessary.
2013-08-08 00:47:48 -05:00
Dave Collins
aad69df74b Include proxy address in connection messages. 2013-08-08 00:35:45 -05:00
Dave Collins
5ca605dadc Remove duplicate proxy setting from config. 2013-08-08 00:22:10 -05:00
Dave Collins
f0a0b06f29 Move sample proxy config near top of net settings. 2013-08-08 00:17:13 -05:00
David Hill
3f782928fd initial proxy code 2013-08-08 00:13:47 -05:00
Dave Collins
9a9f41a2f3 Modify code to use proxy aware NetAddresses.
This paves the way for support with proxied connections.
2013-08-07 23:53:19 -05:00
Dave Collins
0d7bff2444 Remove some unused code. 2013-08-07 23:44:04 -05:00
Dave Collins
b759bafa60 Add version information and -V/--version flags. 2013-08-07 18:53:01 -05:00
Dave Collins
f168694ecf Convert .gitignore line endings to unix. 2013-08-07 15:00:20 -05:00
Dave Collins
8574846e87 Move btcd to root directory.
This allows easier go get paths.
2013-08-07 12:47:51 -05:00
Dave Collins
c9502f0932 Add option to disable listen for incoming conns.
This commit provide support for a new nolisten option which disables
listening for incoming connections.  It also disable listening when the
--connect option is used.
2013-08-07 12:37:46 -05:00
Dave Collins
58055a0b5c Reorder some of the config options. 2013-08-07 12:29:45 -05:00
Dave Collins
3195020fee Improve sample-btcd.conf.
This commit improves the sample-btcd.conf file by including some
explanatory text and adding a few more available options.
2013-08-07 12:12:46 -05:00
Dave Collins
a9662d3169 Disable RPC server if no user/pass is provided.
This commit disables the RPC server by default if no RPC username of
password is specified (either via the command line or through the config
file).

Closes #2.
2013-08-07 11:02:31 -05:00
Dave Collins
ca8496e66d Make IPv4 and IPv6 listen on different sockets.
This commit implements support for listening on multiple sockets and
changes the default listen code to use one socket per address family (IPv4
and IPv6).

In addition, it changes the default listen binding for the RPC server to
localhost so only local clients can connect to it.

There need to be several options added to allow customization of these
settings and those will be in future commits.

Fixes #3.
2013-08-07 10:39:23 -05:00
Dave Collins
c526c3af59 Use external paths for imports.
This commit modifies the import paths to externally accessible paths.
Fixes #1.
2013-08-07 00:33:46 -05:00
Dave Collins
3f54e4199f Initial import. 2013-08-06 19:17:05 -05:00
Dave Collins
c59a86c467 Initial commit. 2013-08-06 11:32:43 -05:00