Commit Graph

150 Commits

Author SHA1 Message Date
David Hill
e26e71a9a2 multi: replace godoc.org with pkg.go.dev 2020-02-18 19:35:19 -06:00
Dave Collins
b2cef202a7
multi: Round 4 prerel module release ver updates.
This modifies all prelease modules to use the latest commit to work out
more transitive dependency issues.  Several of these are needed due to
the dependency chain.

The updated direct dependencies are as follows:

- github.com/decred/dcrd/blockchain/stake/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/blockchain/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/chaincfg/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/connmgr/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/dcrec/secp256k1/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/dcrutil/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/hdkeychain/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/mempool/v4@v4.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/mining/v3@v3.0.0-20200215031403-6b2ce76f0986
- github.com/decred/dcrd/txscript/v3@v3.0.0-20200215031403-6b2ce76f0986
2020-02-14 22:55:06 -06:00
Dave Collins
6b2ce76f09
multi: Round 3 prerel module release ver updates.
This modifies all prelease modules to use the latest commit to work out
more transitive dependency issues.  Several of these are needed due to
the dependency chain.

The updated direct dependencies are as follows:

- github.com/decred/dcrd/blockchain/stake/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/blockchain/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/chaincfg/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/connmgr/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/dcrec/secp256k1/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/dcrutil/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/hdkeychain/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/mempool/v4@v4.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/mining/v3@v3.0.0-20200215023918-6247af01d5e3
- github.com/decred/dcrd/txscript/v3@v3.0.0-20200215023918-6247af01d5e3
2020-02-14 21:14:03 -06:00
Dave Collins
6247af01d5
multi: More prerel module release version updates.
This modifies all prelease modules to use the latest version to work out
more transitive dependency issues.

The updated direct dependencies are as follows:

- github.com/decred/dcrd/blockchain/stake/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/blockchain/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/chaincfg/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/connmgr/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/dcrec/secp256k1/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/dcrutil/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/hdkeychain/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/mempool/v4@v4.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/mining/v3@v3.0.0-20200215015031-3283587e6add
- github.com/decred/dcrd/txscript/v3@v3.0.0-20200215015031-3283587e6add
2020-02-14 20:39:18 -06:00
Dave Collins
3283587e6a
multi: Update all prerel module release versions.
This modifies all prelease modules to use the latest version so they can
be used in require statements in consumer code that is also under
development without running into transitive dependency issues.

The updated direct dependencies are as follows:

- github.com/decred/dcrd/blockchain/stake/v3@v3.0.0-20200214194519-928737b3e580
- github.com/decred/dcrd/blockchain/v3@v3.0.0-20200214194519-928737b3e580
- github.com/decred/dcrd/connmgr/v3@v3.0.0-20200214194519-928737b3e580
- github.com/decred/dcrd/dcrutil/v3@v3.0.0-20200214194519-928737b3e580
- github.com/decred/dcrd/mempool/v4@v4.0.0-20200214194519-928737b3e580
- github.com/decred/dcrd/mining/v3@v3.0.0-20200214194519-928737b3e580
- github.com/decred/dcrd/txscript/v3@v3.0.0-20200214194519-928737b3e580
2020-02-14 19:50:31 -06:00
Donald Adu-Poku
b86418a019 multi: add --peeridletimeout defaulting to 120s.
This adds --peeridletimeout config option and updates the peer
connection to enforce idle timeouts using the connection's read
deadline. Associated testsand documentation have also been updated.
2020-02-14 13:44:43 -06:00
Dave Collins
85f0c09df2
secp256k1: Start v3 module dev cycle.
Upcoming changes constitute breaking public API changes to the secp256k1
module, therefore, this follows the process for introducing major API
breaks which consists of:

- Bump the major version in the go.mod of the affected module if not
  already done since the last release tag
- Add a replacement to the go.mod in the main module if not already done
  since the last release tag
- Update all imports in the repo to use the new major version as
  necessary
- Make necessary modifications to allow all other modules to use the new
  version in the same commit
- Repeat the process for any other modules the require a new major as a
  result of consuming the new major(s)
2020-01-29 13:45:59 -06:00
Dave Collins
be7ab82cf9
chaincfg: Start v3 module dev cycle.
Upcoming changes constitute breaking public API changes to the chaincfg
module, therefore, this follows the process for introducing major API
breaks which consists of:

- Bump the major version in the go.mod of the affected module if not
  already done since the last release tag
- Add a replacement to the go.mod in the main module if not already done
  since the last release tag
- Update all imports in the repo to use the new major version as
  necessary
- Make necessary modifications to allow all other modules to use the
  new version in the same commit
  - Repeat the process for any other modules the require a new major as a
    result of consuming the new major(s)
2020-01-29 13:24:14 -06:00
Dave Collins
83f8020051
multi: Update to prerel module release versions.
This modifies the various modules to use a valid prerelease version so
they can be used in require statements in consumer code that is also
under development.

The updated direct dependencies are as follows:

- github.com/decred/dcrd/blockchain/stake/v3@v3.0.0-20200104000002-54b67d3474fb
- github.com/decred/dcrd/blockchain/v3@v3.0.0-20200104000002-54b67d3474fb
- github.com/decred/dcrd/connmgr/v3@v3.0.0-20200104000002-54b67d3474fb
- github.com/decred/dcrd/dcrutil/v3@v3.0.0-20200104000002-54b67d3474fb
- github.com/decred/dcrd/mempool/v4@v4.0.0-20200104000002-54b67d3474fb
- github.com/decred/dcrd/mining/v3@v3.0.0-20200104000002-54b67d3474fb
- github.com/decred/dcrd/txscript/v3@v3.0.0-20200104000002-54b67d3474fb
2020-01-08 18:52:46 -06:00
Dave Collins
b6d8ccdedf
multi: Address a bunch of lint issues. 2019-12-30 13:54:41 -06:00
David Hill
4971faff25 multi: remove whitespace 2019-11-21 18:31:30 -06:00
Dave Collins
c0408945be
multi: Updates for staticcheck results. 2019-10-31 15:14:35 -05:00
David Hill
e3a04d40c7 txscript: Start v3 module dev cycle.
Several upcoming changes constitute breaking the public API.
2019-10-24 20:48:43 -05:00
Dave Collins
e30a2c81d4
peer: Prepare v2.1.0.
This updates the peer module dependencies and serves as a base for
peer/v2.1.0.

The updated direct dependencies in this commit are as follows:

- github.com/decred/dcrd/txscript/v2@v2.1.0
- github.com/decred/dcrd/wire@v1.3.0
- github.com/decred/go-socks@v1.1.0

The full list of updated direct dependencies since the previous
peer/v2.0.0 release are as follows:

- github.com/decred/dcrd/txscript/v2@v2.1.0
- github.com/decred/dcrd/wire@v1.3.0
- github.com/decred/go-socks@v1.1.0
2019-10-15 14:27:04 -05:00
Dave Collins
a46f9a6c56
peer: Implement getcfilterv2/cfilterv2 listeners. 2019-10-12 12:06:00 -05:00
Dave Collins
3e2208f8c1
build: Replace TravisCI with CI via Github actions. 2019-09-20 19:59:04 -05:00
Dave Collins
fefb993956
peer: Ensure listener tests sync with messages.
This adds an additional read from the ok channel in the peer listener
tests to ensure the version message is consumed as well as the verack so
that the remaining tests line up with the messages that are being tested.
2019-09-03 12:24:38 -05:00
Aaron Campbell
8be96a8729 multi: Correct typos.
Correct typos found by reading code, ispell, and creative grepping.
2019-08-22 10:20:03 -05:00
Aaron Campbell
03678bb754 multi: Correct typos.
Correct typos found by reading code and creative grepping.
2019-08-16 17:37:58 -05:00
Dave Collins
25c14e046a
main: Update to use all new major module versions.
This updates all code in the main module to use the latest major modules
versions to pull in the latest updates.

A more general high level overview of the changes is provided below,
however, there is one semantic change worth calling out independently.

The verifymessage RPC will now return an error when provided with
an address that is not for the current active network and the RPC server
version has been bumped accordingly.

Previously, it would return false which indicated the signature is
invalid, even when the provided signature was actually valid for the
other network.  Said behavior was not really incorrect since the
address, signature, and message combination is in fact invalid for the
current active network, however, that result could be somewhat
misleading since a false result could easily be interpreted to mean the
signature is actually invalid altogether which is distinct from the case
of the address being for a different network.  Therefore, it is
preferable to explicitly return an error in the case of an address on
the wrong network to cleanly separate these cases.

The following is a high level overview of the changes:

- Replace all calls to removed blockchain merkle root, pow, subsidy, and
  coinbase funcs with their standalone module equivalents
  - Introduce a new local func named calcTxTreeMerkleRoot that accepts
    dcrutil.Tx as before and defers to the new standalone func
- Update block locator handling to match the new signature required by
  the peer/v2 module
  - Introduce a new local func named chainBlockLocatorToHashes which
    performs the necessary conversion
- Update all references to old v1 chaincfg params global instances to
  use the new v2 functions
- Modify all cases that parse addresses to provide the now required
  current network params
  - Include address params with the wsClientFilter
- Replace removed v1 chaincfg constants with local constants
- Create subsidy cache during server init and pass it to the relevant
  subsystems
  - blockManagerConfig
  - BlkTmplGenerator
  - rpcServer
  - VotingWallet
- Update mining code that creates the block one coinbase transaction to
  create the output scripts as defined in the v2 params
- Replace old v2 dcrjson constant references with new types module
- Fix various comment typos
- Update fees module to use the latest major module versions and bump it v2
2019-08-13 11:22:37 -05:00
Dave Collins
b726184eaf
release: Introduce peer v2 module. 2019-08-12 15:52:51 -05:00
Dave Collins
e22877abb7
peer: Use latest major version deps.
This udpates the peer module to use the latest module major versions.

The updated direct dependencies are as follows:

- github.com/decred/dcrd/txscript/v2@v2.0.0
2019-08-12 15:52:45 -05:00
Dave Collins
7ff364662e
peer: Accept hash slice for block locators.
This modifies the PushGetBlocksMsg and PushGetHeadersMsg functions to
accept a string of block loactors hashes instead of a concrete
blockchain.BlockLocator to remove the tight couping between the two
packages at the API boundary and allow callers to easily provide custom
values if desired.

It also removes the dependency on the blockchain module since it is no
longer required.
2019-08-12 15:39:49 -05:00
Dave Collins
46fa63adbd
peer: Remove deprecated Config.ChainParams field.
This removes the deprecated ChainParams field from the Config struct and
updates the tests accordingly.

It also removes the dependency on the chaincfg module since it is no
longer required.
2019-08-12 15:38:34 -05:00
Dave Collins
8bbb8b6fff
peer: Prepare v1.2.0.
This updates the peer module dependencies and serves as a base for
peer/v1.2.0.

The updated direct dependencies in this commit are as follows:

- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/chaincfg@v1.5.2
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/txscript@v1.1.0

The full list of updated direct dependencies since the previous
peer/v1.1.0 release are as follows:

- github.com/davecgh/go-spew@v1.1.1
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/chaincfg@v1.5.2
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/lru@v1.0.0
- github.com/decred/dcrd/txscript@v1.1.0
- github.com/decred/go-socks@v1.0.0
2019-08-09 16:07:47 -05:00
Dave Collins
8354a310bc
main: Consume latest module minors and patches.
This updates the main module to use the latest available minor and patch
versions of all modules and reverts the recent change that incorrectly
removed all of the blake256 references from the various go.sum files.

The following required direct dependencies are bumped as follows:

- github.com/decred/dcrd/blockchain/stake@v1.2.1
- github.com/decred/dcrd/blockchain/stake/v2@v2.0.1
- github.com/decred/dcrd/certgen@v1.1.0
- github.com/decred/dcrd/chaincfg@v1.5.2
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/chaincfg/v2@v2.2.0
- github.com/decred/dcrd/dcrutil/v2@v2.0.0
- github.com/decred/dcrd/gcs@v1.1.0
- github.com/decred/dcrd/hdkeychain/v2@v2.0.1
- github.com/decred/dcrd/txscript/v2@v2.0.0
- github.com/decred/dcrwallet/rpc/jsonrpc/types@v1.2.0
2019-08-08 10:05:35 -05:00
Nicola Larosa
1149d54cb9 multi: Use crypto/blake256.
This updates the code to make use of the new crypto/blake256 module instead of
github.com/dchest/blake256.

* change the references in the chaincfg/chainhash and gcs modules
* update chaincfg/chainhash to use the new Sum256 API
* remove references to dchest/blake256 from all go.sum files
2019-08-07 18:54:55 -05:00
Dave Collins
e86bf4da5a
multi: Use decred fork of go-socks.
This modifies the code to use the decred fork of the go-socks module
throughout and updates the affected modules to use the v1.0.0 release of
the socks module.
2019-07-22 12:14:42 -05:00
David Hill
893aa30dce multi: Use https links where available. 2019-06-18 14:20:06 -05:00
Dave Collins
c33be8c68c
multi: Update all modules for chaincfg v1.5.1.
This updates all of the modules that still rely on v1 of the chaincfg
module to use v1.5.1 which builds correctly with the major API bump
introduced in the edwards v1.0.0 module.

While here, it also updates all references to the v0 edwards and dcrec
modules to their tagged v1 counterparts, tidies all of the modules via
go mod tidy, and removes all unnecessary indirect entries from the mod
files to keep the modules using the versions the dependencies are tested
with.

The primary motivation for this change is that the chaincfg/v2 module
requires edwards/v1 which is not API compatible with edwards/v0.
Consequently, in order for each module to be incrementally updated to
use chaincfg/v2, all of its dependencies must also be able to build with
edwards/v1 which is the case as of chaincfg v1.5.1.
2019-06-17 15:54:31 -05:00
Dave Collins
0ab86a42f3
peer: Prevent last block height going backwards.
This modifies the UpdateLastBlockHeight function to ensure the new
height is after the existing height before updating it in order to
prevent it from going backwards so it properly matches the intent of the
function which is to report the latest known block height for the peer.

Without this change, the value will properly start out at the latest
known block height reported by the peer during version negotiation,
however, it will be set to lower values when syncing from the peer due
to requesting old blocks and blindly updating the height.

It also adds a test to ensure proper functionality.
2019-05-22 04:06:59 -05:00
David Hill
213be705bc peer: pendingMsgs is a FIFO 2019-03-28 16:54:20 -05:00
David Hill
699c0ad23f peer: invSendQueue is a FIFO 2019-03-28 16:54:20 -05:00
Dave Collins
bccd308af3
build: Tidy module sums (go mod tidy). 2019-03-25 11:37:00 -05:00
David Hill
3d2d557614 multi: deprecate DisableLog 2019-03-18 11:16:35 -05:00
David Hill
69bac3189f multi: drop init and just set default log 2019-03-18 11:16:35 -05:00
Dave Collins
fa047415fd
peer: Use lru cache module for nonces.
This updates the concrete peer sent nonces LRU cache to make use of the
new generic LRU cache provided by the lru module.

It also removes the nor longer necessary specialized implementation.
2019-03-18 10:08:45 -05:00
Dave Collins
eb1368a3c4
peer: Use lru cache module for inventory.
This updates the concrete peer known inventory LRU cache to make use of
the new generic LRU cache provided by the lru module.

It also removes the nor longer necessary specialized implementation.
2019-03-18 10:08:35 -05:00
Dave Collins
0f50fd5f8c
multi: Add go 1.11 directive to all modules.
This adds the go 1.11 directive to all of the modules in order to
clearly mark they build and work with that version.  Go 1.12 modified
the tools such that tidy will automatically add the new version to
modules that do not already have a directive and that would prevent
builds on Go 1.11 through Go 1.11.3 which is not desirable.
2019-03-18 02:02:35 -05:00
Dave Collins
5473e7907f
peer: Deprecate dependency on chaincfg.
The only way the chain params are used by the peer is to ascertain the
network magic to use on the wire (the Net field), so rather than
requiring an entire chain params instance, it is desirable to reduce the
scope such that the caller only needs to specify the specific value the
module peer needs.

To that end, this introduces a new field named Net on the config struct
which the caller can optionally specify in the same vain as the chain
params could previously optionally be specified.

The ultimate goal is to remove the chaincfg dependency altogether,
however, since removing the public ChainParams field is a breaking API
change, the field is deprecated and, in order to maintain API
compatibility, some additional semantics around handling of the
optionalality of the new Net field are introduced.

In particular, the Net field is chosen as follows:

- Use the value specified by the caller directly when set
- Fallback to the network associated with the chain params when set
- Fallback to the test network if neither are set

Finally, it updates the example and tests to specify the network
directly and adds a new test which explicitly tests the new fallback
semantics.
2019-03-16 21:10:59 -05:00
Dave Collins
837b289343
peer: Consolidate tests into package.
Putting the test code in the same package makes it easier for forks
since they don't have to change the import paths as much and it also
gets rid of the need for export_test.go to bridge.
2019-03-16 20:55:28 -05:00
Dave Collins
e052b9cbf2
multi: Remove non-root module replacements.
This modifies all of the modules, with the exception of the root module,
to remove all replacement directives from their go.mod files and update
the requirements and module sums accordingly.

While it is nice to be able to build and test directly from each module
directory and have it pull in the latest untagged changes when
developing, having all of the overrides in each module makes it
infeasible to use the module tools to help maintain the modules and thus
makes it quite difficult to ensure they are all independently accurate
for external consumers.

By maintaining all of the overrides in the root module and invoking all
builds and tests from it, the overrides will apply to ensure the latest
code is being built and tested.

This also modifies the tests script used with in CI to run all of the
tests from the root module accordingly.
2019-02-08 18:01:43 -06:00
Dave Collins
1a370d38d6
release: Tidy module files with published versions. 2018-12-12 12:18:11 -06:00
Dave Collins
220d434b6e
release: Bump module versions and deps.
This bumps the various module versions as follows:

- github.com/decred/dcrd/dcrec/secp256k1@v1.0.1
- github.com/decred/dcrd/dcrjson@v1.1.0
- github.com/decred/dcrd/database@v1.0.3
- github.com/decred/dcrd/blockchain/stake@v1.1.0
- github.com/decred/dcrd/mining@v1.1.0
- github.com/decred/dcrd/certgen@v1.0.2
- github.com/decred/dcrd/connmgr@v1.0.2
- github.com/decred/dcrd/mempool@v1.1.0

In addition, it serves as a base for tagging releases of the following
module versions that have previous been bumped since the last release,
but not yet tagged:

- github.com/decred/dcrd/wire@v1.2.0
- github.com/decred/dcrd/chaincfg@v1.2.0
- github.com/decred/dcrd/dcrutil@v1.2.0
- github.com/decred/dcrd/txscript@v1.0.2
- github.com/decred/dcrd/blockchain@v1.1.0
- github.com/decred/dcrd/hdkeychain@v1.1.1
- github.com/decred/dcrd/peer@v1.1.0
- github.com/decred/dcrd/rpcclient@v1.1.0

Finally, it updates all of the dependencies for every module accordingly,
adds a few missing overrides for transitive dependencies, and tidies up
some of the go module sum files.
2018-12-10 11:18:00 -06:00
Dmitry Fedorov
e2effe836b
dcrjson: Add listtickets command.
This adds an RPC to list all tickets belonging to current wallet with
ticket, spender transactions' info and status.
2018-10-11 16:21:34 -05:00
Dave Collins
81c76dcb78
multi: Break blockchain dependency on dcrjson.
This modifies the ChainTips function in blockchain to return the results
using a type defined in the blockchain package itself instead of
directly returning a dcrjson type.  This is preferable since nothing
else in the module depends on dcrjson and therefore allows the
dependency on the dcrjson module to be broken.

It also updates the RPC server that makes use of the function to perform
the necessary conversions.

Finally, the associated module hierarchy documentation is updated to
properly remove the no longer required dependency.

It should be noted that this is a breaking change to the API and thus
will need a v2 major version bump of the blockchain module to be
published before the changes can be externally consumed.
2018-10-10 16:44:20 -05:00
Dave Collins
d051b8aacd
peer: Provide immediate queue inventory func.
This adds a new function to peers which allows an inventory vector to be
queued for immediate send versus the standard trickling batched
inventory queue method while still respecting the functionality which
filters attempts to notify peers about inventory that they are already
known to have.
2018-09-10 09:57:51 -05:00
Josh Rickmar
00a3f0eb60 peer: Protect handlePongMsg with p.statsMtx 2018-09-06 14:48:29 -04:00
Dave Collins
97a8f5f34c
peer: Add support for specifying ua comments.
This adds a new parameter named UserAgentComments to the peer Config
struct so that callers may specify additional comments to add to the
user agent string.

It also updates the server to include the prelease portion of the
semantic version as a comment when creating peers.
2018-08-21 13:44:01 -05:00
Dave Collins
36f61d8ebd build: Tidy module sums (go mod tidy). 2018-08-16 20:03:27 -05:00