Commit graph

28 commits

Author SHA1 Message Date
Dave Collins 074b2374b8
Import btcrpcclient repo into rpcclient directory.
This commit contains the entire btcrpcclient repository along with
several changes needed to move all of the files into the rpcclient
directory in order to prepare it for merging.  This does NOT update btcd
or any of the other packages to use the new location as that will be
done separately.

- All import paths in the old btcrpcclient files have been changed to
  the new location
- All references to btcrpcclient as the package name have been changed to
  rpcclient
2017-08-15 19:51:58 -05:00
Ruben de Vries c72658166a add InvalidateBlock RPC command 2017-07-04 15:56:36 +02:00
David Hill e3e4c726af Add GetMempoolEntry API 2017-02-03 14:27:05 -05:00
Alex abcdfb702a Port rescanblocks JSON-RPC command from dcrd 2017-01-27 14:43:43 -07:00
Olaoluwa Osuntokun c6e1d711da review: fix typos 2016-11-09 11:13:10 -08:00
Olaoluwa Osuntokun 01050a2f82
add support for getblockchaininfo 2016-11-06 16:07:47 -08:00
David Hill 6e5c0a7904 Fix GetBlockVerbose API.
This changes the GetBlockVersion API to not send a third parameter.
The third parameter is a boolean that expands the transaction data
structures as well.  However, Bitcore Core does not recognize this
feature.

GetBlockVerbose now only takes a hash value.

Users of the GetBlockVerbose(hash, true) must now use
GetBlockVerboseTx(hash).
2016-09-16 12:35:52 -04:00
Dave Collins 982229439a Return wire.MsgBlock from GetBlock(Async).
This modifies the return value of the GetBlock and GetBlockAsync
functions to a raw *wire.MsgBlock instead of *btcutil.Block.

This is being done because a btcutil.Block assumes there is a height
associated with the block and the block height is not part of a raw
serialized block as returned by the underlying non-verbose RPC API
getblock call and thus is not available to populate a btcutil.Block
correctly.

A raw wire.Block correctly matches what the underlying RPC call is
actually returning and thus avoids the confusion that could occur.
2016-09-15 14:06:36 -05:00
David Hill 8ff9623a8c Add API for getblockheader
GetBlockHeader returns the blockheader of the specified blockhash.
GetBlockHeaderVerbose returns the data structure with information about
the blockheader of the specified blockhash.

Fixes #89
2016-09-15 13:39:27 -04:00
Dave Collins c39e35318d Update for recent chainhash-related API changes. (#81)
This updates all code to make use of the new chainhash package since the
old wire.ShaHash type and related functions have been removed in favor
of the abstracted package.

Also, while here, rename all variables that included sha in their name
to include hash instead.
2016-08-08 14:16:04 -05:00
Dave Collins b046f36c72 Relicense to the btcsuite developers. 2015-05-01 12:03:51 -05:00
Dave Collins ce9e8aa264 Update btcjson path import paths to new location. 2015-05-01 10:42:52 -05:00
Dave Collins c4bc5220bc Update for recent GetTxOut argument change. 2015-04-05 23:00:29 -05:00
Dave Collins 9ca93b30ad Update to make use of latest version of btcjson.
This commit contains several changes needed to update the client to use
the latest version of btcjson.  In addition, it contains a couple of other
minor changes along the way.

While the underlying changes are quite large, the public API of this
package is still the same, so caller should generally not have to update
their code due to that.  However, the underlying btcjson package API has
changed significantly.  Since this package hides the vast majority of that
from callers, it should not afffect them very much.  However, one area in
particular to watch out for is that the old btcjson.Error is now
btcjson.RPCError, so any callers doing any type assertions there will need
to update.

The following is a summary of the changes:

- The underlying btcjson significantly changed how commands work, so the
  internals of this package have been reworked to be based off of requests
  instead of the now non-existant btcjson.Cmd interface
- Update all call sites of btcjson.New<Foo>Cmd since they can no longer
  error or take varargs
- The ids for each request are part of the request now instead of the
  command to match the new btcjson model and are strict uint64s so type
  assertions are no longer needed (slightly improved efficiency)
- Remove the old temporary workaround for the getbalance command with an
  account of "*" since btcwallet has since been fixed
- Change all instances of JSONToAmount to btcutil.NewAmount since that
  function was removed in favor of btcutil.Amount
- Change all btcws invocations to btcjson since they have been combined
2015-04-05 22:56:39 -05:00
Dave Collins 23ab2bf329 Update btcjson path import paths to new location. 2015-02-19 12:00:51 -06:00
Dave Collins ed821410cb Update btcwire path import paths to new location. 2015-02-05 15:50:03 -06:00
Dave Collins 64231158a0 Update btcjson import paths to new location. 2015-01-16 23:56:08 -06:00
Dave Collins c1df139e32 Update btcwire import paths to new location. 2015-01-16 15:28:53 -06:00
Dave Collins 3dfefc978f Update btcutil import paths to new location. 2015-01-15 10:41:20 -06:00
Dave Collins c74bb4e087 Update license year to 2015. 2015-01-03 02:24:28 -06:00
David Hill 37fbff291c Add missing error check 2014-12-13 10:02:59 -05:00
Jimmy Song 59e825d796 Added GetTxOut as a possible command to btcrpcclient.
Put into chain.go vs other places as per @davecgh
2014-10-26 17:30:10 -05:00
Dave Collins 0e463baf95 goimports -w . 2014-07-02 19:34:05 -05:00
Josh Rickmar 1ec6dde39c Add custom/raw request/response support. 2014-06-11 16:38:54 -05:00
Dave Collins 4e8e63e0d7 Use bytes.NewReader for all deserialization.
Rather than using bytes.NewBuffer, which is a read/write entity
(io.ReadWriter), use bytes.NewReader which is only a read entitiy
(io.Reader).  Benchmarking shows it's slightly faster and it's also
technically more accurate since it ensures the data is read-only.
2014-06-04 22:12:47 -05:00
Dave Collins 9d9c343247 Make nil pointer handling consistent across RPCs.
There are several RPCs which accept a pointer to a hash, transaction,
block, etc.  Previously not all RPCs handled being passed a nil pointer
consistently.

Closes #4.
2014-05-21 19:53:46 -05:00
GeertJohan 0cc22e1134 Make btcrpcclient use the new and consistent reply types. 2014-05-07 11:23:00 -05:00
Dave Collins e3f130ade5 Initial commit. 2014-05-07 11:14:39 -05:00