Commit Graph

4151 Commits

Author SHA1 Message Date
Josh Rickmar
e189ec47ba rpcserver: Undeprecate getwork
Unlike Bitcoin, the getwork JSON-RPC is not deprecated in Decred.  Remove this
language from the command help.
2019-03-08 00:33:02 -06:00
Hamid
e40b33a2b1 chaincfg: Move a test to chainhash package.
This moves a test in chaincfg which belongs to chainhash package.
The test case that has been moved has already been covered in
chainhash test suite, but instead of deleting the test case it has
been moved, so to have a stronger test suite.
2019-03-08 00:28:27 -06:00
David Hill
15b1f1cf2d rpcserver: remove unused quit chan 2019-03-08 00:26:45 -06:00
Jamie Holdstock
9ea5bd3bb3 docs: fix formatting in json rpc doc.
Removes an unnecessary line from the `getblockheader` table in json_rpc_api.md which prevents it from displaying correctly.
2019-03-07 19:49:43 -06:00
Matheus Degiovani
6628e8d02d server: Remove instead of disconnect node
This changes the behavior of peer disconnection logic, such that
permanent peers are actually removed from the connection manager when
requested, instead of just being disconnected and therefore triggering a
future retry.

Previously, this prevented the addnode [addr] remove from correctly
removing permanent peers. A connection retry attempt would always be
performed.
2019-03-07 19:34:35 -06:00
Matheus Degiovani
95d0b00874
rpcclient: Add EstimateSmartFee
This adds the EstimateSmartFee command to the rpc client, so that the
corresponding remote function can be reached.
2019-03-06 08:57:22 -03:00
David Hill
4e7f080b7b blockmanager: only check if current once handling inv's
This saves two additional calls to chain.IsCurrent().
2019-02-17 16:07:52 -06:00
David Hill
6dbd89322c travis: test go1.12 2019-02-17 15:51:49 -05:00
Hamid
adc41abf59 wire: Add tests for MsgCFTypes
This adds standard wire tests for MsgCFTypes. Things done in these
commit:
- Add standard wire test for MsgCFTypes
- Fix a potential bug at BtcEncode: return an error if the number
	of filter types exceed the maximum number of supported filter
	types (256)
- Add an extended error checking for checking malformed encoded
	data return correct errors.
2019-02-16 19:07:08 -06:00
Dave Collins
a9fb05ba20
travis: Add misspell linter. 2019-02-14 22:59:32 -06:00
Dave Collins
cf3f55f6b0
dcrutil: Fix typos found by misspell. 2019-02-14 22:59:08 -06:00
Dave Collins
5cb2bceb2f
blockchain: Fix typos found by misspell. 2019-02-14 22:22:58 -06:00
Dave Collins
fc4d68a327
main: Update for mempool/v2.
This updates the main module to use version 2 of the mempool module.

The following is a summary of changes:

- Update all imports to use mempool/v2
- Update module requirements to include new module and remove no longer
  needed old versions
- Add an override for the v2 module so CI is always builds with the
  latest code
- Update rpcserver getrawmempool to make use of new mempool
  VerboseTxDescs instead of the removed RawMempoolVerbose
- Update rpcserver getrawmempool to properly return the parameter
  provided for the transaction type instead of the type of variable in
  the case an invalid type is provided
- Update rpcserver getrawmempool to return the supported transaction
  types in the error when an invalid type is provided
2019-02-14 19:59:22 -06:00
Dave Collins
dd585b7b55
main: Tidy module to latest. 2019-02-14 19:50:05 -06:00
Dave Collins
6f106adf57
docs: Update for mempool v2 module.
This updates the docs/README.md file, module hierarchy graphviz, and
module hierarchy diagram to reflect the new module version
2019-02-14 18:52:48 -06:00
Dave Collins
5b44a55ec3
release: Introduce mempool v2 module. 2019-02-14 18:52:47 -06:00
Dave Collins
d7d0edb95a
mempool: Remove tight coupling with dcrjson.
Currently, there is a tight coupling between the rpcserver and the
mempool by way of the RawMempoolVerbose function returning a
dcrjson.GetRawMempoolVerboseResult.

In order to remove the tight coupling, this introduces a new type and
function to the mempool module named VerboseTxDesc and VerboseTxDescs,
respectively, which provide all of the details necessary for the
rpcserver to be able to properly generate the dcrjson response
directly.

Also, it removes the old RawMempoolVerbose function and related
dependency imports on dcrjson since it is no longer required as a part
of moving to mempool/v2.

Note that since this constitutes a major break to the API, the mepool
module version will need to be bumped to version 2.
2019-02-14 18:52:46 -06:00
Dave Collins
eae2ad41dd
mempool: Remove deprecated min high prio constant.
This removes the deprecated MinHighPriority constant as part of moving
to mempool/v2.

Note that since this constitutes a major break to the API, the mepool
module version will need to be bumped to version 2.
2019-02-14 18:52:46 -06:00
Dave Collins
78d83767f9
release: Freeze version 1 mempool module.
This serves as the final release of version 1 of the mempool module.
All future releases will be moving to version 2 of the module.

Consequently, it bumps the module version as follows:

- github.com/decred/dcrd/mempool@v1.2.0

It also removes the mempool override in the root module and updates it so building the
software will still produce binaries based on the v1 module until the v2
module is fully released.
2019-02-14 18:52:43 -06:00
Dave Collins
c0124570cd
txscript: Rename p2sh indicator to isP2SH.
This renames the flag that indicates whether or not the script engine is
executing a pay-to-script-hash script pair to a name that more
accurately describes its behavior.
2019-02-14 16:35:30 -06:00
Dave Collins
1f5abadc08
txscript: Add remove signature reference test.
An important (and easy for implementations to miss) aspect of the
CHECKSIG opcodes is that the full signature (signature plus hash type)
that is being checked is first removed from the script prior to
calculating the signature hash against which the signature is verified.

It appears the test in the upstream btcsuite code for this was removed
during the initial Decred port instead of being converted as it should
have been.

Consequently, this converts the relevant test so it is correct for
Decred and adds it to the reference tests.  Note that the first of the
two added tests is to ensure the original signature is valid prior to
testing the actual removal condition.
2019-02-14 14:10:12 -06:00
Dave Collins
8cbc7ed672
rpcserver: Update for dcrjson/v2.
This updates the code related to the RPC server to use version 2 of the
dcrjson module.
2019-02-14 13:43:55 -06:00
Dave Collins
bbd3f3b0d1
rpctest: Update for rpccclient/v2 and dcrjson/v2.
This updates the rpctest harness to use version 2 of the rpcclient
module as well as version 2 of the dcrjson module.
2019-02-14 13:03:34 -06:00
Dave Collins
eab1e279c1
dcrctl: Update for dcrjson/v2 and wallet types.
This updates dcrctl to use version 2 of the dcrjson module and to make
use of the new separate type definitions provided by wallet so it
continues supporting communication with dcrwallet.
2019-02-14 12:32:12 -06:00
Dave Collins
895020ac5e
docs: Update for rpcclient v2 module.
This updates the docs/README.md file, module hierarchy graphviz, and
module hierarchy diagram to reflect the new module version
2019-02-14 11:44:01 -06:00
Dave Collins
797b43a13e
rpcclient: Introduce v2 module using wallet types.
This updates the rpcclient module to use version 2 of the dcrjson module
and to make use of the new separate type definitions provided by wallet
which are no longer available directly in the new dcrjson module.

Since this constitutes a major break to the API, it also bumps the
module version to version 2.

While here, it adds an override for dcrjson/v2 to the root module now to
ensure builds and CI always run the latest code outside of releases.

It should also be noted that this only introduces the new module and
does not update any external modules to make use of it yet.
Consequently, it also removes the rpcclient override in the root module
so building the software will still produce binaries based on the v1
module until this v2 module is fully released.
2019-02-14 11:43:57 -06:00
Dave Collins
9265b40510
docs: Update for dcrjson v2 module.
This updates the docs/README.md file, module hierarchy graphviz, and
module hierarchy diagram to reflect the new module version.
2019-02-13 19:23:38 -06:00
Dave Collins
8ad612b642
dcrjson: Introduce v2 module without wallet types.
This removes all wallet-specific type definitions and tests from the
dcrjson module since they are being moved into their own module that
lives in the dcrwallet repository.

Since this constitutes a major break to the API, it also bumps the
module version to version 2.
2019-02-13 19:23:38 -06:00
Dave Collins
3ce1ee9652
dcrjson: Move new tickets ntfn to correct file.
This moves the definition and associated code for the newtickets
notification to the chainsvrwsntfns.go file since it is served by the
chain RPC websocket server.  It also moves the associated test to the
chainsvrwsntfns_test.go file
2019-02-13 19:23:37 -06:00
Dave Collins
0103753174
dcrjson: Move stake diff ntfn to correct file.
This moves the definition and associated code for the stakedifficulty
notification to the chainsvrwsntfns.go file since it is served by the
chain RPC websocket server.
2019-02-13 19:23:37 -06:00
Dave Collins
56fd2089b3
dcrjson: Move spent tickets ntfn to correct file.
This moves the definition and associated code for the
spentandmissedtickets notification to the chainsvrwsntfns.go file since
it is served by the chain RPC websocket server.  It also moves the
associated test to the chainsvrwsntfns_test.go file accordingly.
2019-02-13 19:23:36 -06:00
Dave Collins
d0d265cc42
dcrjson: Move winning tickets ntfn to correct file.
This moves the definition and associated code for the winningtickets
notification to the chainsvrwsntfns.go file since it is served by the
chain RPC websocket server.  It also moves the associated test to the
chainsvrwsntfns_test.go file accordingly.
2019-02-13 19:23:36 -06:00
Dave Collins
bffca0f0cc
dcrjson: Move best block result to correct file.
This moves the result definition for the getbestblock command to the
chainsvrresults.go file since it is served by the chain RPC server.
2019-02-13 19:23:35 -06:00
Dave Collins
86bc1b9e11
dcrjson: Move raw stake tx cmds to correct file.
This moves the command definitions and associated types for the
createrawsstx and createrawssrtx commands to the chainsvrcmds.go file
since they are served by the chain RPC server.
2019-02-13 19:23:34 -06:00
Dave Collins
23010917b9
dcrjson: Move estimate fee test to matching file.
This moves the test for estimatefee to the chainsvrcmds_test.go file to
match the fact it's defined in chainsvrcmd.go.
2019-02-13 19:23:34 -06:00
Dave Collins
7daccb91d9
dcrjson: Update README.md.
This updates README.md to call out it implements decred JSON-RPC API and
correct a style nit.
2019-02-13 19:23:33 -06:00
Dave Collins
64fa9601ce
build: Require dcrjson v1.2.0. 2019-02-13 19:23:33 -06:00
Jonathan Chappelow
0e9b69bfd9 dcrjson: add cointype to WalletInfoResult
This adds the active coin type to the dcrjson.WalletInfoResult.
Since watching-only wallets do not store the coin type keys, the
CoinType field is tagged as "cointype,omitempty" so that it will be
omitted when the default value of 0 is set, as is the case when the
wallet has an error of kind dcrwallet/errors.WatchingOnly.

The location of CoinType in the struct is chosen in part because it will
not change the size of the struct because of the preceding bools that
leave room in padding for a 32-bit value.
2019-02-13 11:44:33 -06:00
David Hill
85443cafa9 multi: cleanup linter warnings 2019-02-13 08:38:25 -05:00
David Hill
201965fe92 travis: run linters in each module 2019-02-10 10:28:33 -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
David Hill
b1bbf8091b txscript: code cleanup
- switch if-else to switch/case for readability
- remove unused params
2019-02-08 09:18:53 -05:00
Dave Collins
457a797a03
mempool: Reject same block vote double spends.
Currently, the memory pool policy is to allow votes which double spend
the same ticket (up to a maximum amount) since it is possible that the
same ticket is selected in competing branches and thus the double spend
must be allowed and will resolve itself depending on which chain is
ultimately extended.

A side effect of that is that it also currently accepts votes with
different hashes but otherwise both spend the same ticket and vote on
the same block.  This can happen when there are multiple wallets casting
the vote with different settings such as when one has been upgraded to a
new stake version while the others have not or an improperly configured
wallet where the vote choices have been set on one, but not the others.

Consequently, this modifies the policy to explicitly reject these
duplicate votes while still allowing votes on competing branches.

It also adds tests to ensure the new functionality works as expected.
2019-02-08 04:52:23 -06:00
Dave Collins
98f633d1ee
mempool: Limit max vote double spends exactly.
This modifies the check which limits the maximum allowed votes double
spending the same ticket to exactly the specified constant instead of
one more.

It also adds tests for the max vote double spend handling to both ensure
they are accepted up until the max, rejected thereafter, and that
removing votes allows them to be accepted again.
2019-02-08 04:48:22 -06:00
Dave Collins
e7c4835357
mempool: Accept test mungers for vote tx.
This modifies CreateVote in the mempool test harness to accept munge
functions similar to how CreateSignedTx works.  This allows the test
code to more easily mutate the transactions as desired prior to them
being signed which provides greater flexibility.

While here, it also sets the block that is being voted on to the current
best chain tip of the harness.  While there is not currently anything in
the tests that relies on that behavior, it will allow future tests to
more easily create votes which involve the block being voted on.
2019-02-08 03:06:48 -06:00
Dave Collins
b4f564b30b
config: Remove deprecated getworkkey option.
This removes the long deprecated --getworkkey option and associated
code.  This realistically should have been done before Decred was even
launched as it was deprecated in the upstream code before dcrd was ever
even started.
2019-02-08 02:04:58 -06:00
Sarlor
4fd8cb7c60 blockchain: Optimize skip stakebase input.
This optimizes to check the traversal position first since it is more
likely in deserializeSpendJournalEntry func.
2019-02-08 01:30:15 -06:00
Sarlor
dcd2d701b5 mining: Optimize get the block's votes tx.
The optimizes to check the height of the next block is greater than the
threshold first since it is more likely in the NewBlockTemplate
function.
2019-02-08 01:25:53 -06:00
Dave Collins
73a60c8f02
dcrctl: Make version string consistent.
This makes the version string printed by the -V/--version flag
consistent with dcrd.  In particular it will now include the runtime
version, OS, and architecture.
2019-02-05 10:24:49 -06:00
Dave Collins
59ed4247a1
blockchain: Use harness in fixed seqlock tests.
This refactors the fixed sequence lock tests in blockchain to use the
recently introduced chaingen harness.
2019-01-30 10:16:49 -06:00