Commit Graph

167 Commits

Author SHA1 Message Date
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
0035880ac7
docs: Update for dcrjson/v3 module. 2019-07-22 13:29:31 -05:00
Josh Rickmar
b112df6417 dcrjson: Introduce v3 and move types to module.
This commit introduces a new major version of the dcrjson module which
removes all dcrd RPC type support, instead focusing only on method and
type registration.  The dcrd methods and types are moved to the
github.com/decred/dcrd/rpc/jsonrpc/types module.

In order to improve backwards compatibility with dcrjson/v2, the API
has been modified to register methods as interface{} instead of
string.  This allows different method string types to be used to key
parameter types during registration and lookup, and will allow
dcrjson/v2 to forward registrations of RPC methods to v3 without
causing duplicate registrations errors for incompatible types.

With the introduction of the new types package, the RPC API has been
modified to replace concatenated hash blobs to JSON string arrays of
hash strings.  The RPC API major version is bumped to reflect this
change.

A future update to dcrjson/v2 will add additional registrations,
forwarding the registrations to v3 and replacing command types with
type aliases where possible.  Unfortunately, this can not be done
entirely in a single commit due to dcrjson/v2 and dcrjson/v3 sharing
the same directory in the source tree, and a branch will need to be
used for this update.

Module replacements are temporarily used to enable the changes for the
main module, including dcrctl.  After the aforementioned update to
dcrjson/v2 and a forthcoming update to dcrwallet's RPC types package,
these replacements will be removed.
2019-07-19 08:49:49 -05:00
Josh Rickmar
e4f5e3f84f dcrjson: Remove API breaking change
dcrjson will require a minor bump before the next major.
Unfortunately, the master branch contains a breaking change since the
prior 2.0.0 tag.  This commit reverts that change and prepares the
module for a 2.1.0 release.
2019-07-09 14:40:57 -04:00
Donald Adu-Poku
c83194268f multi: add version arg to decodescript rpc. 2019-06-26 20:43:50 -05:00
David Hill
893aa30dce multi: Use https links where available. 2019-06-18 14:20:06 -05:00
Donald Adu-Poku
ad3c180abb config: Parse network interfaces.
This adds config helpers for parsing network interface
states based on the config parameters set. Work towards getnetworkinfo implementation.
2019-03-28 22:54:21 -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
Jamie Holdstock
9a5161ce9e rpcserver: Add difficultyratio to getblockchaininfo.
Add DifficultyRatio to GetBlockChainInfoResult, and bump the minor rpc
version accordingly. This is to maintain consistency with GetDifficulty
RPC. Also deprecate the existing Difficuly field in
GetBlockChainInfoResult, to be removed in a future major version bump.
2019-03-11 00:44:17 -05:00
David Hill
d25931fd35
multi: preallocate memory. 2019-03-09 16:43:48 -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
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
f27ac9ff4d multi: switch to golangci-lint.
multi: Switch to golangci-lint.
2019-01-24 00:12:31 -06:00
Matheus Degiovani
300b6848c9
multi: Integrate fee estimation
This commit performs the necessary modifications to hook the fee
estimation facility added by the previous commit into the node software.

The block manager is modified to notify the estimator of all new blocks,
such that their transactions can be accounted for, and the mempool is
modified to relay transactions entering and leaving it, so that those
transactions can be tracked.

The results of the estimator can be queried by issuing estimatesmartfee
rpc commands to the node.
2018-12-06 19:41:52 -02:00
Dmitry Fedorov
9585d602c0 dcrjson: Add gettransaction txtype/ticketstatus. 2018-11-28 11:28:17 -06:00
Dave Collins
6d647094ee
multi: Return total chain work in RPC results.
This modifies the getblock and getblockheader RPC results to include the
total number of hashes expected to produce the chain up to the requested
block in hex and updates the JSON-RPC API documentation accordingly.
2018-10-16 11:30:58 -05:00
Dave Collins
3a2bdcc332
multi: Cleanup getblock and getblockheader RPCs.
This modifies the getblock and getblockheader RPC results to be a little
more consistent in their ordering, to include the extra data field in
the getblockheader results, and to update the JSON-RPC API documentation
for both to match reality.  The documentation was missing several fields
and had some typos.
2018-10-16 11:24:46 -05: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
ggoranov
d2a18365bd multi: Cleanup the unsupported dcrwallet commands.
This cleans up both dcrjson and rpcclient packages from methods
added from btcctl fork but not implemented by dcrwallet.

dcrjson methods removed:

- ImportAddressCmd
- ImportPubKeyCmd
- SendToSSGenCmd
- SendToSSRtxCmd
- SendToSStxCmd
- SetBalanceToMaintainCmd
- SetTicketMaxPriceCmd

rpcclient methods removed:

- ImportAddress, ImportAddressAsync
- ImportAddressRescan, ImportAddressRescanAsync
- ImportPubKey, ImportPubKeyAsync
- ImportPubKeyRescan, ImportPubKeyRescanAsync
- SendToSStx, SendToSStxAsync
- SendToSStxMinConf, SendToSStxMinConfAsync
- SendToSSGen, SendToSSGenAsync
- SendToSStxComment, SendToSStxCommentAsync
- SendToSSGenComment, SendToSSGenCommentAsync
- SendToSSRtxAsync, SendToSSRtxCommentAsync

As a result dcrctl does not list anymore these commands:

- importaddress
- importpubkey
- sendtossgen
- sendtossrtx
- sendtosstx
- setbalancetomaintain
- setticketmaxprice
2018-10-11 14:15:22 -05:00
Dave Collins
bd3a416cae
multi: Address some golint complaints. 2018-10-10 19:50:06 -05:00
Donald Adu-Poku
1ec04c40a2 multi: Add getblockchaininfo rpc. 2018-10-09 18:28:17 -05:00
vracek@protonmail.com
52109eab99 dcrjson: additions for pay to contract hash 2018-10-08 16:16:16 -05:00
Dave Collins
4a503a0f12
rpcserver: Remove createrawssgen RPC.
This removes the handler for the createrawssgen RPC and deprecates the
associated dcrjson structures.

This is being done because it doesn't make any sense for votes to be
created over the RPC interface.  In order for voting on the previous
block to have any semblance of relevance, the software producing the
vote clearly must have code to deserialize and understand the relevant
data structures.
2018-09-12 17:40:54 -05:00
Dave Collins
5db19ddcab
multi: Include additional fields on RPC tx results.
This modifies the results provided by the getrawtransaction and
searchrawtransactions RPCs to make them consistent with each other.

In particular, it adds the transaction expiry, block height, and block
index fields to the searchrawtransactions result and ensures that both
omit the block height when it is zero so that it is not included in the
results for mempool transactions.

Since populating the block index requires additional details to be
stored to the transaction index to efficiently provide, only the
infrastructure is added and the value is left as the default for now,
which means it will be omitted and therefore not change the visible
behavior.

Finally, it also updates the RPC server help to provide consistent
descriptions for the fields and also updates the JSON-RPC documentation.
2018-09-10 09:18:01 -05:00
Dave Collins
295179fc0d
build: Refine build module support.
This further refines the modules to add the following new modules
instead of depending on the entire dcrd module:

- github.com/decred/dcrd/dcrjson@v1.0.0
- github.com/decred/dcrd/blockchain@v1.0.0
- github.com/decred/dcrd/blockchain/stake@v1.0.0
- github.com/decred/dcrd/gcs@v1.0.0
- github.com/decred/dcrd/mining@v1.0.0
- github.com/decred/dcrd/mempool@v1.0.0
- github.com/decred/dcrd/peer@v1.0.0
- github.com/decred/dcrd/rpcclient@v1.0.0

Also, it ensures modules that rely on other modules within the repo are
provided replacements to the latest repo code to ensure builds against
master and continuous integration use the latest code.

- github.com/decred/dcrd/addrmgr
- github.com/decred/dcrd/blockchain
- github.com/decred/dcrd/blockchain/stake
- github.com/decred/dcrd/chaincfg
- github.com/decred/dcrd/connmgr
- github.com/decred/dcrd/database
- github.com/decred/dcrd/dcrec/secp256k1
- github.com/decred/dcrd/dcrjson
- github.com/decred/dcrd/dcrutil
- github.com/decred/dcrd/gcs
- github.com/decred/dcrd/hdkeychain
- github.com/decred/dcrd/mempool
- github.com/decred/dcrd/mining
- github.com/decred/dcrd/peer
- github.com/decred/dcrd/rpcclient
- github.com/decred/dcrd/txscript
- github.com/decred/dcrd/wire
2018-08-05 20:45:45 -05:00
Dave Collins
e2232a5c3d
dcrjson: Remove unused vote bit concat codec funcs.
These functions and associated tests are being removed because nothing
depends on them and they end up creating a dependency on
blockchain/stake package, which is not desirable.
2018-08-05 16:24:56 -05:00
vctt94
aafe460fd9 dcrjson: add fundrawtransaction command 2018-07-29 02:04:04 -05:00
Dave Collins
2ba78e9a8e
dcrjson: Make linter happy by renaming Id to ID.
Also, update all callers in the repository while here.
2018-07-24 00:44:20 -05:00
Dave Collins
d75e22a52d
dcrjson: Consolidate tests into dcrjson 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.

Also, correct a couple of comments while here.
2018-07-23 18:20:13 -05:00
Dave Collins
807b534d07
multi: Remove go modules that do not build.
This removes a bunch of build modules that rely on a version of dcrd
that doesn't exist and updates the root module so dcrd can be built with
the upcoming go1.11 release.
2018-07-21 17:59:44 -05:00
Josh Rickmar
e62476cd72 dcrjson: Ready GetStakeInfoResult for SPV wallets.
This change makes the following fields omitempty so they can be
ignored by SPV wallets:

 * poolsize
 * allmempooltix
 * live
 * proportionlive
 * missed
 * proportionmissed
 * expired

As a side-effect, non-SPV wallets will also omit these fields from the
result if the value is zero.

The following counts remain:

 * ownmempooltix
 * immature
 * voted
 * revoked

And two new fields have been added to allow SPV wallets to provide a
fuller picture of the wallet's ticket state counts:

 * unspent
 * unspentexpired

The `unspent` field describes the number of tickets that have gone
live and have not been spent by a vote or revocation.  The
`unspentexpired` field describes the number of unspent tickets that
must certainly be revoked as they have not been spent by a vote and
have passed the expiry period.  These tickets may have been called and
missed, or actually expired, but a SPV wallet is aware that they must
be revoked as they cannot possibly be live.

These changes are being made due to SPV wallets being unaware of what
state a matured ticket is in (whether live, picked, or missed) and
because SPV wallets do not know the ticket pool size or the number of
all unmined tickets.
2018-07-03 10:10:51 -04:00
Donald Adu-Poku
1acb88472e multi: add amount field to TransactionInput.
This adds an amount field to TransactionInput intended for specifying the prev out amount when creating a transaction. createraw/ssrtx/sgentx/transaction rpcs are also updated accordingly as well as associated tests.

A typo in assignField is also corrected.
2018-06-21 23:54:42 +00:00
Donald Adu-Poku
5386a63758 multi: revert TicketChange addition to PurchaseTicketCmd
This reverts the split_tx/ticket_change addition to PurchaseTickeCmd. From a discussion had with raedah and jrick on purchasing tickets we concluded that change created by direct ticket purchases will adhere to coinbase maturity before becoming available for spending. We will not be circumventing this by not setting the expiry for sstxchange.

The only ideal scenario currently for purchasing tickets directly is with inputs equal to the stake difficulty plus the fee.
2018-06-12 15:12:57 -05:00
matadormel
cc7901aa06 dcrjson: Fix NewCreateRawTransactionCmd comment
The `NewCreateRawTransactionCmd` currently shows `// Amounts are in BTC` in the comments section (I assume from btcd), I have changed 'BTC' to 'DCR' in the comment.
2018-06-07 15:32:40 +08:00
Donald Adu-Poku
4840587397 multi: move extension commands into associated normal command files.
This consolidates all commands and tests into their respective normalfiles. BtcdConnectedNtfn has been renamed DcrdConnectedNtfn.
2018-06-03 12:04:20 -05:00
Donald Adu-Poku
1e9205e86a multi: modify PurchaseTicketCmd.
This renames the SplitTx field to TicketChange since it better describes
the feature being opted into. The field type was also changed to a bool
pointer.
2018-05-31 11:10:59 -05:00
Shweini
5ec7a2a36c multi: Change NoSplitTransaction param to SplitTx.
The SplitTx parameter for PurchaseTicketCmd specifies theminimumnumberof inputs needed to use a split transaction for aticketpurchase. Theparameter options are 1 and 2. Ticket purchaseinputsless than the setSplitTx value are used directly in thetransaction.
2018-05-27 14:37:29 +00:00
Dave Collins
45e313e6d2
multi: Define vgo modules.
This adds module support for the versioned go toolchain.  In particular,
the following packages are defined as modules:

* addrmgr
* blockchain
* certgen
* chaincfg
* connmgr
* database
* dcrjson
* dcrutil
* gcs
* hdkeychain
* mempool
* mining
* peer
* rpcclient
* txscript
* wire

It does not update the travis build environment or README since it is
experimental at this point.
2018-05-25 15:38:16 -05:00
Dmitry Fedorov
569f703105 dcrjson: add createvotingaccount and dropvotingaccount rpc methods
methods help to import and drop xpub key to generate
addresses on behalf of another wallet
2018-05-24 22:14:45 +03:00
David Hill
6adfdf6bdc dcrjson: add estimatesmartfee 2018-05-11 15:16:44 -04:00
vctt94
b789995319 dcrjson: Add Expiry field to CreateRawTransactionCmd 2018-05-02 20:49:03 -05:00