Commit Graph

2863 Commits

Author SHA1 Message Date
David Hill
bb51d32f69 Log the actual error as well. (#676) 2017-04-28 21:09:42 -04:00
John C. Vernaleo
5bed758f85 Bump for v1.0.1 2017-04-28 11:22:19 -05:00
Dave Collins
2dfb055f93
rpcserver: Disable getblocktemplate.
This disables the getblocktemplate RPC handler since it does not at all
work as intended.  Fixing it is going to be a larger effort, so just
disable it until it can be properly implemented.
2017-04-28 11:14:34 -05:00
Dave Collins
b2d479ad38
rpcserver: Return handler errors to RPC client.
Only the first parameter to the rpcInternalError function is returned to
RPC clients, so any errors that originate in the handlers need to be
passed as the first parameter.

The second context parameter is to allow additional context to be added
to errors coming from underlying calls.  There is no additional context
for errors generated by the RPC handlers themselves.
2017-04-28 10:58:44 -05:00
Dave Collins
bcfe793c55
wire: Cleanup blockheader.go.
This corrects the comment for the MaxBlockHeaderPayload variable to
match reality, removes an extraneous TODO that has already been done,
and makes the readBlockHeader and writeBlockHeader functions use a style
consistent with the rest of the code.
2017-04-28 10:34:11 -05:00
David Hill
6c1a2a6beb peer: bump max protocol to wire.MaxBlockSizeVersion 2017-04-28 10:33:33 -05:00
David Hill
e9b1ca95b3 wire: Add MaxBlockSizeVersion const
MaxBlockSizeVersion is the protocol version which increased the
original blocksize.
2017-04-28 10:33:33 -05:00
Peter Banik
45e579b71a Fixed broken link to documentation 2017-04-27 19:46:01 -05:00
John C. Vernaleo
5c3e0d6454 Bump for v1.0.0
Remove beta label
2017-04-26 13:26:02 -05:00
Dave Collins
468e045098
chaincfg: Add agenda for LN support vote.
This adds a new agenda to mainnet which allows the stake holders to
vote on whether or not they want the developers to begin work on
integrating lightning network support.
2017-04-26 13:17:58 -05:00
Dave Collins
734684d288
multi: Implement stake difficulty change and vote.
This implements a new stake difficulty algorithm along with a voting
agenda for all networks to change and a comprehensive set of tests.  It
also implements estimation using the new algorithm for the
estimatestakediff RPC.

The following is an overview of the changes:

- Add new agenda to vote on changing the stake difficulty algorithm to
  all networks
  - The version on mainnet is version 4
  - The version on testnet and simnet is version 5
- Modifies the stake difficulty calculation function to calculate the
  difficulty based on the result of the vote
- Modifies the stake difficulty estimation function to calculate the
  difficulty based on the result of the vote
- Makes the stake difficulty estimation function concurrent safe
  - Calls it directly from the RPC server instead of going through block
    manager
  - Removes no longer needed code from the block manager
- Generate new version blocks and reject old version blocks after a
  super majority has been reached
  - New block version on mainnet is version 4
  - New block version on testnet and simnet is version 5
- Add tests for the supply estimation used in the new algorithm
- Add tests for the new algorithm calculations
- Add tests for the estimation based on the new algorithm
2017-04-26 13:00:28 -05:00
Josh Rickmar
f23ca04f95 rpcserver: Use a real value for fee estimates.
More dependencies on the global config in main isn't great but the
actual value in the mempool policy isn't exported at this time.
2017-04-24 18:03:51 -04:00
Josh Rickmar
dc2168c59d mempool: Remove the hardcoded minimum ticket fee.
The minimum ticket fee is now handled the same as for all other
transactions and it as well as the relative maximum high fee threshold
can be changed using the application config.
2017-04-24 16:49:37 -05:00
Dave Collins
8bc8183680
blockchain: Remove dead code from diff tests.
This removes dead code from the difficulty_test.go file in the
blockchain package.
2017-04-24 16:30:49 -05:00
Dave Collins
05d8456d3e
multi: Rename vote choice IsIgnore to IsAbstain.
This renames the chaincfg parameter for the vote choice which represents
an abstaining vote to be named IsAbstain instead of IsIgnore since that
more accurately describes its intent and behavior.

It also updates the RPC server choice result field for isignore to be
named isabstain to match and bumps the major version accordingly.

Finally, it renames other internal variables which make use of the
choice to include the word abstain as well for clarity and renames a
couple of other internal variables.
2017-04-24 16:17:27 -05:00
Josh Rickmar
e5ad26d39d Increase the high fee multiplier to keep same threshold.
When the minimum relay fee was modified from 0.01 to 0.001 DCR/kB this
value was not changed, causing the new high fee threshold to be 0.1
DCR/kB.  After discussion, we want to keep the same default high fee
threshold as before, especially as this value is used to limit
unintended high fees for ticket purchases.
2017-04-24 11:31:18 -04:00
Dave Collins
8b1f8d5c8c
policy: Lower default relay fee to 0.001/kB.
This lowers the default minimum relay fee to 0.001 DCR/Kb from its
previous value of 0.01 DCR/Kb.

It should be noted that this is only a default node policy change and as
such does not affect the consensus rules in any way.
2017-04-24 09:40:15 -05:00
jolan
512ed390f0 chaincfg: update checkpoints for 1.0.0 release (#661) 2017-04-24 09:07:06 -05:00
Josh Rickmar
ff07aac47f dcrjson: Add getvotechoices/setvotechoice types.
Remove all types for get/setticketvotebits.  These RPCs are being
removed from dcrwallet (which will no longer support saving per-ticket
vote bits).
2017-04-11 12:04:59 -04:00
Marco Peereboom
05dea4826c Remove a bunch of dead code.
Do some spring cleaning while here.
2017-04-10 15:03:40 -05:00
jolan
2acdc98135 dcrjson: add generatevote and remove some unused pieces (#652) 2017-04-07 12:56:55 -05:00
Marco Peereboom
f5439c31c9 rpcserver: always reply with an RPC error.
Ensure that all errors return an RPC error.  Try to match the type as
well.  Also some miscellaneous clean ups.
2017-04-04 07:47:29 -05:00
David Hill
2723f36918 glide: sync (#650)
Pull in dcrrpcclient and dcrutil changes for better memory allocation.
Add ssh/terminal used by cmd/promptsecret
2017-03-31 14:34:37 -04:00
David Hill
44c5d6ad7d Add new tool, promptsecret (#649)
promptsecret is used to read a secret from stdin without echoing and
write it to stdout.
2017-03-31 14:00:18 -04:00
David de Kloet
64a414c64f wire: Treat NetAddress more like immutable
Replace assignments to individual fields of wire.NetAddress with
creating the entire object at once, as one would do if the type was
immutable.

In some places this replaces the creation of a NetAddress with a
high-precision timestamp with a call to a 'constructor' that converts
the timestamp to single second precision. For consistency, the tests
have also been changed to use single-precision timestamps.

Lastly, the number of allocations in readNetAddress have been reduced by
reading the services directly into the NetAddress instead of first into
a temporary variable.
2017-03-24 17:07:28 -04:00
dskloet
c58b7577e1 addrmgr: Remove unused param from GetAddress()
addrmgr.GetAddress() had a parameter `class string` originally intended
to support looking up addresses according to some type of filter such as
IPv4, IPv6, and only those which support specific wire.ServiceFlags
(full nodes, nodes that support bloom filters, nodes that support
segwit, etc). But currently the parameter is unused and also has an
inappropriate type `string`.

If it would ever be used, it's easy to add back and should then get an
appropriate type such as something that allows bitflags to be set so
that the caller could request combinations such as peers that support
IPv6, are full nodes, and support bloom filters.
2017-03-24 17:06:43 -04:00
David Hill
11faf1d6d6 addrmgr: Fix AddressCache to not include nils
allAddr was being allocated with counters instead of the actual size
of the address map.  This led to the possibility of including nils
in the returned slice, which resulted in a panic.
2017-03-24 17:06:27 -04:00
David Hill
f31f24fec7 blockchain: various code cleanups 2017-03-24 15:58:52 -04:00
Dave Collins
eb7e11ebda
dcrd: Remove unnecessary upstream deps.txt.
The deps.txt file is a relic from the upstream project from which dcrd
forked and does not apply to dcrd since it only contains really old
btcd-specific commit hashes from before the project switched to using
glide.
2017-03-23 06:45:37 -05:00
Dave Collins
3ce4b02e4e
dcrd: Remove unused old chainindexer file.
The chainindexer.go file is completely commented out and has been
replaced by a new indexing infrastructure.  This removes the entire file
since it is no longer required.
2017-03-23 02:21:02 -05:00
Josh Rickmar
3a61f8c61f Add example service files.
This adds example service files to run dcrd as a system service for systemd and
illumos SMF.

Waiting on an rc.d before this is merged...

Closes #561.
2017-03-23 02:07:08 -05:00
John C. Vernaleo
68deca1fe3 Add warning on startup about old testnet data.
Done in a loop so future testnets can be added in as needed.
2017-03-22 13:39:10 -04:00
Dave Collins
9b76b78168
server: Return error on address lookup fails.
This corrects an issue introduced by commit
e8f63bc29550705268b533032ccc2ea24f8c86ba where a failure to lookup a
hostname could lead to a panic in certain circumstances.  An error is
now returned in that case as expected.
2017-03-21 19:43:28 -05:00
Olaoluwa Osuntokun
c31eb4549d connmgr: switch to using net.Addr interface throughout for addresses
This commit modifies the `ConnManager` to use the `net.Add` interface
through the package instead of a plain string to represent and
manipulate addresses. This change makes the package much more general as
users of the package can possibly utilize custom implementations of the
`net.Addr` interface to establish connections.

More precisely, the `ConnReq` struct has been modified to use a net.Addr
instance explicitly, and the `DialFunc` type has also been modified to
take a `net.Addr` directly. This latter change gives functions that
adhere to the `DialFunc` type more flexibility as to exactly how the
connection is established.

Additionally, the `connmgr.Config.GetNewAddress` configuration option
now directly returns a `net.Addr. This change allows the `connmgr` to be
decoupled from all DNS queries which allows callers to preferentially
select more secure methods like performing DNS lookups over a Tor proxy.
2017-03-21 19:43:25 -05:00
Dave Collins
cb4a6452e0
connmgr: Add tests for new inbound listener logic. 2017-03-21 19:43:21 -05:00
Dave Collins
1be83e5319
connmgr: Implement inbound connection handling.
This modifies the connection manager to provide support for accepting
inbound connections on a caller-provided set of listeners and notify the
caller via a callback.

This is only the minimum work necessary to get inbound support into the
connection manager.  The intention for future commits is to move more
connection-related logic such as limiting the maximum number of overall
connections and banned peer tracking into the connection manager.
2017-03-21 19:43:15 -05:00
Dave Collins
3b187d3817
connmgr: Remove type defs for callbacks.
This removes the type definitions for the callback functions in favor of
declaring them directly in the Config struct.  This is more consistent
with the rest of the code base and is preferred since it means callers
reviewing the documentation don't have to follow another level of
indirection to figure out the signature.
2017-03-21 19:43:08 -05:00
Javed Khan
628c9e8b2d server: Use Disconnect in handleDonePeerMsg 2017-03-21 19:43:05 -05:00
Javed Khan
56da31dec5 server: Check max peers before connecting 2017-03-21 19:43:05 -05:00
Javed Khan
ea0238ec44 connmgr: Retry only if below target outbound conns 2017-03-21 19:43:04 -05:00
Javed Khan
a5487a01de connmgr: Rename max outbound to target outbound 2017-03-21 19:43:03 -05:00
Javed Khan
c05ef678b7 server: Cap max outbound in connmgr cfg at max peers 2017-03-21 19:43:03 -05:00
David Hill
0eea64362c connmgr: unexport the DynamicBanScore mutex. 2017-03-21 19:43:02 -05:00
Dave Collins
9e9dd98d94
peer: Use debug log for inability to start peer.
The inability for a peer to negotiate is not something that should be a
warning which implies something is wrong.  On the contrary, it is quite
expected that various peers will connect (or be connected to) that are
unable to properly negotiate for a variety of reasons.  One example would
be a peer that is too old.

Also, while here take care of a few style nits.
2017-03-21 19:42:57 -05:00
Dave Collins
1f9a89bebe
server: Notify connmgr if server peer assoc fails.
This corrects a few issues introduced with the connection manager where
the server was not notifying the connection manager when a connection
request is available again.

The cases resolved are:
- Unable to initialize a server peer instance in response to the connection
- Failure to associate the connection with the server peer instance
- Disconnection of a non-persistent outbound peer

It also changes the log message to a debug in the former case because
it's not something that should be shown to the user as an error given
it's not due to anything the user has misconfigured nor is it even
unexpected if an invalid address is provided.
2017-03-21 19:42:50 -05:00
Dave Collins
918fe7c4c5
peer: Track and return advertised protocol version
This adds a new field to the peer struct which stores the protocol
version advertised by the remote peer and updates the StatsSnapshot to
return the advertised version instead of the negotiated version.
2017-03-21 19:42:41 -05:00
Dave Collins
58ece81431
server: Remove unused wakeup channel.
This channel is no longer used since the outgoing connection logic is
handled by the connmgr package now.
2017-03-21 19:42:32 -05:00
David Hill
462c432cd2 peer: BestLocalAddress config option is no longer used. 2017-03-21 19:42:28 -05:00
David Hill
ab541dd587 peer: Stop setting AddrMe in the version message.
Older nodes previously added the IP and port information to the address
manager which proved to be unreliable as an inbound connection from a
peer didn't necessarily mean the peer itself accepted inbound
connections.

This also fixes a bug where the peer package was incorrectly sending
the peer's services as its own.
2017-03-21 19:42:27 -05:00
David Hill
82dcbf807b Do not add inbound peers to the address manager. 2017-03-21 19:42:26 -05:00