Commit Graph

108 Commits

Author SHA1 Message Date
Alex Yocom-Piatt
d4172fb0eb Bump for v1.1.2 2017-11-20 18:53:16 -06:00
Josh Rickmar
6842aa006d Merge remaining dcrutil code into a dcrd package.
This merge commit adds the following code from the
github.com/decred/dcrutil package into a new
github.com/decred/dcrd/dcrutil package:

* Address handling
* Amount type
* AppDataDir func
* bitflags functions
* Block wrapper type
* Hash160 func
* Tx wrapper type
* WIF type

as well as all tests for this code.

The old github.com/decred/dcrutil/hdkeychain package has also been
merged and moved to github.com/decred/dcrd/dcrutil/hdkeychain.

dcrd packages have been updated to use the new packages and the dep
files have been updated for this change.
2017-10-11 22:06:36 -04:00
Dave Collins
a4d4179143
rpcclient: Merge dcrrpcclient repo. 2017-10-11 14:25:50 -05:00
Josh Rickmar
27981a5a7d Move self signed certificate code into certgen package.
Use this package instead of relying on dcrutil certificate generation
functions.
2017-10-10 17:23:38 -04:00
Alex Yocom-Piatt
1500e972e2 Bump for v1.1.0 (#867) 2017-09-22 11:56:37 -05:00
Jean-Christophe Mincke
5115a422f0 multi: Error descriptions are in lower case.
Functions fmt.Error(), errors.New() are inspected.

Files under the dcrd/vendor directory are ignored.
2017-09-08 18:03:59 +02:00
Donald Adu-Poku
539fb844cc glide: use jessevdk/go-flags for consistency. 2017-08-30 19:08:18 -05:00
David Hill
aa2b50714e Bump for v1.0.8 (#832) 2017-08-24 16:15:38 -05:00
David Hill
a8469025e4 Bump for v1.0.7 2017-08-15 14:47:48 -05:00
Dave Collins
511594960e
blockchain: Sync main chain flag on ProcessBlock.
Contains the following upstream commits:
- 42a4366ba8
  - This is a NOOP since it has already previously been applied
- 77913ad2e8

Most of the changes related to this merge have already previously
applied, so this primarily just minimizes the differences versus
upstream.
2017-07-26 14:16:13 -05:00
John C. Vernaleo
384c024c66 dcrctl: Add --walletrpcserver option.
This option allows one to specify a different option for the wallet
rpc server it will connect to.  This is primarily meant to be used in
the config file so that a single dcrctl.conf may be used in the
situation where the wallet is on one host and dcrd is on another host.
2017-07-17 13:47:39 -04:00
John C. Vernaleo
0d406ffde8 Bump for v1.0.5 2017-06-20 16:47:02 -04:00
Josh Rickmar
ce4b77d3d9 all: Remove seelog logger.
The btclog package has been changed to defining its own logging
interface (rather than seelog's) and provides a default implementation
for callers to use.

There are two primary advantages to the new logger implementation.

First, all log messages are created before the call returns.  Compared
to seelog, this prevents data races when mutable variables are logged.

Second, the new logger does not implement any kind of artifical rate
limiting (what seelog refers to as "adaptive logging").  Log messages
are outputted as soon as possible and the application will appear to
perform much better when watching standard output.

Because log rotation is not a feature of the btclog logging
implementation, it is handled by the main package by importing a file
rotation package that provides an io.Reader interface for creating
output to a rotating file output.  The rotator has been configured
with the same defaults that btcd previously used in the seelog config
(10MB file limits with maximum of 3 rolls) but now compresses newly
created roll files.  Due to the high compressibility of log text, the
compressed files typically reduce to around 15-30% of the original
10MB file.
2017-06-20 10:58:10 -04:00
John C. Vernaleo
016915c33d Add -j/json option to dcrctl.
This option lets dcrctl print the raw json it both
sends and receives for commands.

Inspired by the similar option in dcrtime.
2017-06-15 09:37:23 -04:00
John C. Vernaleo
b90ee0c98a Bump for v1.0.3 2017-06-07 13:45:19 -04:00
John C. Vernaleo
5bed758f85 Bump for v1.0.1 2017-04-28 11:22:19 -05:00
John C. Vernaleo
5c3e0d6454 Bump for v1.0.0
Remove beta label
2017-04-26 13:26:02 -05: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 Hill
7cb68f472a dcrctl: Be smarter about automatic configuration.
dcrctl does not require dcrd so it should not keep complaining about
it missing.  Just skip automatic configuration if dcrd's configuration
is missing, but still set it up in the future if one appears and dcrctl
is still lacking a configuration file.
2017-03-20 14:17:06 -04:00
John C. Vernaleo
ef71103c95 Remove variables for testnet v1. 2017-03-16 20:19:07 -04:00
David Hill
caa57df468 travis: enable gometalinter (#603)
* Hook up gometalinter

* travis: enable unconvert

* travis: enable gosimple
2017-03-08 15:44:15 -05:00
John C. Vernaleo
f60aab08be Differentian dev and release in -V
By default, put 'dev' in the prerelease field.

For release builds we can add 'release' with the build scripts.

Update comment for current (post 1.5) usage on ldflags -X while there.
2017-02-20 09:24:36 -05:00
Josh Rickmar
33483abb2c dcrctl: Remove --terminal feature (#580)
The problem of securely prompting for secrets and not leaving secrets in shell
history can be solved in better ways, such as implementing a tool to read a
secret and write it back to standard output, allowing the secret to be piped to
dcrctl.  Luckily dcrctl already supports this feature!

No (official) tool exists so far, but the workflow would look like this:

  promptsecret | dcrctl --wallet walletpassphrase - 60

While here removing unneeded deps from the glide files, also throw in an
unrelated dcrrpcclient dep update.
2017-02-17 08:25:23 -05:00
John C. Vernaleo
4af97d2d70 Bump for v0.8.2 2017-02-15 14:27:36 -05:00
John C. Vernaleo
71e3acce1e Bump for v0.8.0 2017-02-13 14:48:52 -05:00
John C. Vernaleo
a4de235531 Bump for v0.7.0 2016-12-23 17:05:03 -05:00
Josh Rickmar
da8a0334fa Pull in latest dcrutil. (#508)
Switch to using P-521 for certs created by dcrd and gencerts.
2016-12-07 14:59:21 -05:00
David Hill
b26ffbdb1b Bump to v0.6.1 (#492) 2016-11-25 21:34:20 -06:00
Dave Collins
c162fbde71
multi: Upstream chainhash abstraction sync
Contains the following commits:

- 711f33450c
- b6b1e55d1e
  - Reverted because Travis is already at a more recent version
- bd4e64d1d4

Also, the merge commit contains the necessary decred-specific
alterations, converts all other references to sha to hash to keep with
the spirit of the merged commits, and various other cleanup intended to
bring the code bases more in line with one another.
2016-11-16 12:48:40 -06:00
Dave Collins
748ecb2a52
blockchain: Associate time src with chain instance.
Upstream commit 00ebb9d14d

Also, the merge commit contains the necessary decred-specific
alterations.
2016-11-11 18:06:09 -06:00
John C. Vernaleo
3000ee0e6b Bump for v0.6.0 2016-11-04 07:42:06 -04:00
Jonathan Chappelow
e7dcfbc982 Output of --help/-h should go to os.Stdout rather than os.Stderr (#386)
Fixes #105
2016-11-03 12:42:04 -05:00
David Hill
2bae2c02de dcrctl: Set width to max in --terminal (#436)
Fixes #424
2016-11-03 10:17:57 -05:00
Dave Collins
77913ad2e8
blockchain: Expose main chain flag on ProcessBlock.
This modifies the blockchain.ProcessBlock function to return an
additional boolean as the first parameter which indicates whether or not
the block ended up on the main chain.

This is primarily useful for upcoming test code that needs to be able to
tell the difference between a block accepted to a side chain and a block
that either extends the main chain or causes a reorganize that causes it
to become the main chain.  However, it is also useful for the addblock
utility since it allows a better error in the case a file with out of
order blocks is provided.
2016-10-13 16:47:50 -05:00
Josh Rickmar
d58299b059 Replace some unnecessary dcrutil.Tx usage with wire.MsgTx. (#419) 2016-10-12 13:57:47 -04:00
David Hill
d4860d75f0 dcrctl: fix output in --terminal mode (#416) 2016-10-11 10:54:59 -04:00
C Jepson
393c48d32e Fix the dumpblockchain function (#405)
The dumpblockchain function used to serialize a map of block
into gob serialized format, which was used for testing but which
was incompatible with the addblock tool.  The function now dumps
a flat file the the same format required by the addblock tool.

A couple shutdown assertions were added as well, to prevent
potential panics if pointers were nil.  The duration of time
it took to sync the blockchain with addblock is now
reported.
2016-10-10 11:35:46 -05:00
John C. Vernaleo
af40801d40 Bump for v0.5.0 2016-10-04 12:16:42 -04:00
Marco Peereboom
1c180c1106 Reconcile btcd and dcrd auto generated config file semantics
Fixes #316
2016-09-26 11:59:04 -05:00
cjepson
3eaf445c52 Merge in btcd commit 'dc83f4ee6a127038dc0238600bdc745d239cf8b1'
Merges in btcd commit dc83f4ee6a.
2016-09-23 15:03:16 -04:00
John C. Vernaleo
1001c19da0 Do not error if dcrctl can't find dcrd.conf.
Closes #303
2016-09-08 13:21:48 -04:00
John C. Vernaleo
6c162def5f Bump for v0.4.0 (#336) 2016-09-01 13:30:12 -05:00
Dave Collins
3740feb673 database: Replace with new version.
This commit removes the old database package, moves the new package into
its place, and updates all imports accordingly.
2016-08-23 17:40:38 -04:00
Dave Collins
b6d426241d blockchain: Rework to use new db interface.
This commit is the first stage of several that are planned to convert
the blockchain package into a concurrent safe package that will
ultimately allow support for multi-peer download and concurrent chain
processing.  The goal is to update btcd proper after each step so it can
take advantage of the enhancements as they are developed.

In addition to the aforementioned benefit, this staged approach has been
chosen since it is absolutely critical to maintain consensus.
Separating the changes into several stages makes it easier for reviewers
to logically follow what is happening and therefore helps prevent
consensus bugs.  Naturally there are significant automated tests to help
prevent consensus issues as well.

The main focus of this stage is to convert the blockchain package to use
the new database interface and implement the chain-related functionality
which it no longer handles.  It also aims to improve efficiency in
various areas by making use of the new database and chain capabilities.

The following is an overview of the chain changes:

- Update to use the new database interface
- Add chain-related functionality that the old database used to handle
  - Main chain structure and state
  - Transaction spend tracking
- Implement a new pruned unspent transaction output (utxo) set
  - Provides efficient direct access to the unspent transaction outputs
  - Uses a domain specific compression algorithm that understands the
    standard transaction scripts in order to significantly compress them
  - Removes reliance on the transaction index and paves the way toward
    eventually enabling block pruning
- Modify the New function to accept a Config struct instead of
  inidividual parameters
- Replace the old TxStore type with a new UtxoViewpoint type that makes
  use of the new pruned utxo set
- Convert code to treat the new UtxoViewpoint as a rolling view that is
  used between connects and disconnects to improve efficiency
- Make best chain state always set when the chain instance is created
  - Remove now unnecessary logic for dealing with unset best state
- Make all exported functions concurrent safe
  - Currently using a single chain state lock as it provides a straight
    forward and easy to review path forward however this can be improved
    with more fine grained locking
- Optimize various cases where full blocks were being loaded when only
  the header is needed to help reduce the I/O load
- Add the ability for callers to get a snapshot of the current best
  chain stats in a concurrent safe fashion
  - Does not block callers while new blocks are being processed
- Make error messages that reference transaction outputs consistently
  use <transaction hash>:<output index>
- Introduce a new AssertError type an convert internal consistency
  checks to use it
- Update tests and examples to reflect the changes
- Add a full suite of tests to ensure correct functionality of the new
  code

The following is an overview of the btcd changes:

- Update to use the new database and chain interfaces
- Temporarily remove all code related to the transaction index
- Temporarily remove all code related to the address index
- Convert all code that uses transaction stores to use the new utxo
  view
- Rework several calls that required the block manager for safe
  concurrency to use the chain package directly now that it is
  concurrent safe
- Change all calls to obtain the best hash to use the new best state
  snapshot capability from the chain package
- Remove workaround for limits on fetching height ranges since the new
  database interface no longer imposes them
- Correct the gettxout RPC handler to return the best chain hash as
  opposed the hash the txout was found in
- Optimize various RPC handlers:
  - Change several of the RPC handlers to use the new chain snapshot
    capability to avoid needlessly loading data
  - Update several handlers to use new functionality to avoid accessing
    the block manager so they are able to return the data without
    blocking when the server is busy processing blocks
  - Update non-verbose getblock to avoid deserialization and
    serialization overhead
  - Update getblockheader to request the block height directly from
    chain and only load the header
  - Update getdifficulty to use the new cached data from chain
  - Update getmininginfo to use the new cached data from chain
  - Update non-verbose getrawtransaction to avoid deserialization and
    serialization overhead
  - Update gettxout to use the new utxo store versus loading
    full transactions using the transaction index

The following is an overview of the utility changes:
- Update addblock to use the new database and chain interfaces
- Update findcheckpoint to use the new database and chain interfaces
- Remove the dropafter utility which is no longer supported

NOTE: The transaction index and address index will be reimplemented in
another commit.
2016-08-18 15:42:18 -04:00
John C. Vernaleo
864b4d34b9 Bump for v0.3.0 2016-08-10 15:11:49 -04:00
Dave Collins
bd4e64d1d4 chainhash: Abstract hash logic to new package. (#729)
This is mostly a backport of some of the same modifications made in
Decred along with a few additional things cleaned up.  In particular,
this updates the code to make use of the new chainhash package.

Also, since this required API changes anyways and the hash algorithm is
no longer tied specifically to SHA, all other functions throughout the
code base which had "Sha" in their name have been changed to Hash so
they are not incorrectly implying the hash algorithm.

The following is an overview of the changes:

- Remove the wire.ShaHash type
- Update all references to wire.ShaHash to the new chainhash.Hash type
- Rename the following functions and update all references:
  - wire.BlockHeader.BlockSha -> BlockHash
  - wire.MsgBlock.BlockSha -> BlockHash
  - wire.MsgBlock.TxShas -> TxHashes
  - wire.MsgTx.TxSha -> TxHash
  - blockchain.ShaHashToBig -> HashToBig
  - peer.ShaFunc -> peer.HashFunc
- Rename all variables that included sha in their name to include hash
  instead
- Update for function name changes in other dependent packages such as
  btcutil
- Update copyright dates on all modified files
- Update glide.lock file to use the required version of btcutil
2016-08-08 14:04:33 -05:00
David Hill
9069906139 dcrctl: fix reading from stdin in terminal mode (#294)
Fixes #77
2016-08-03 16:19:54 -04:00
John C. Vernaleo
7716a500fd Bump version to v0.2.0 2016-07-22 11:22:12 -04:00
C Jepson
525770d48a Attempt to fix the broken paths in config autogen (#290)
The configuration autogenerator currently does not work well
and tries to read the sample file based on where the compiled
source's data directory was. This has been fixed so that dcrd
only checks the %PROGRAMFILES% directory on Windows where the
sample configuration file might be stored. Configuration
autogeneration has been disabled for toehr operating systems.
2016-07-20 13:17:20 -05:00
Alex Yocom-Piatt
b88cf9e80c Remove help fallthrough so help will get passed to RPC (#275)
Fixes #42
2016-07-20 11:47:01 -05:00