Commit graph

126 commits

Author SHA1 Message Date
Dave Collins
bbec5f3a91 Update websocket import paths to new location. 2015-01-15 17:25:14 -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
a8dda1fabf Add ListReceivedByAddress support.
This commit also fixes a couple of comment typos found while adding
support for ListReceivedByAddress.

Closes #20.
2014-10-26 17:16:28 -05:00
Javed Khan
331f25f506 compatiblity hack for blockchain.info getbalance 2014-09-10 21:22:09 +05:30
Josh Rickmar
160a843171 Allow websocket conns to be established after New.
ok @davecgh
2014-07-25 13:17:43 -05:00
Josh Rickmar
6b8ff7f52f Use block shas for rescan begin/end.
Also send block sha and block time for rescanprogress/finished.

ok @davecgh
2014-07-25 13:17:30 -05:00
Dave Collins
a07dadb600 Add Move support.
This commit adds the Move, MoveAsync, MoveMinConf, MoveMinConfAsync,
MoveComment, and MoveCommentAsync functions for issuing the "move" RPC
with various optional parameters.

Closes #16.
2014-07-09 21:42:50 -05:00
Michalis Kargakis
406dd2fcb7 Fix typos 2014-07-08 15:40:53 +03:00
Dave Collins
656fa8699b Improve disconnect and shutdown handling.
Previously the exported Disconnect and Shutdown functions called each other
and therefore needed to release and reacquire the locks which could
potentionally allow a request to sneak in between the lock and unlock.

This commit changes the exported Shutdown function so that everything is
done under the request lock to prevent this possibility.  In order to
support this, the shared code between the Disconnect and Shutdown
functions has been refactored into unexported functions and the locking
has been altered accordingly.

Also, replace the sendMessage function with a select over the send and
disconnect channels to prevent any issues with queued up messages.

joint debugging effort between myself and @jrick
2014-07-07 21:58:13 -05:00
Josh Rickmar
1a23feb53e Fix hang on new request receives after shutdown.
Previously, requests could still be sent to a shutdown client and
added to the client's internal data structures, without ever
responding to the future with an error for a shutdown client (causing
hangs when blocking on the future receive).  This change fixes this by
performing a non-blocking read of the client's shutdown channel before
adding a request, and responding with the shutdown error if the client
has begun or completed its shutdown.

ok @davecgh
2014-07-07 19:11:50 -05:00
Dave Collins
1a866200e3 Improve websocket connection error handling.
This commit modifies the error handling for websocket connections to fall
back to returning the status text returned from the server if the
handshake fails and it's not due to an authentication or invalid endpoint.
2014-07-03 12:31:53 -05:00
Tomás Senart
77fdb1011b Handle non successfull HTTP responses
This change set equips the RPC client with handling of non successful
HTTP responses. An HTTP response is considered non successful when its
status code is not in the range 200..299
2014-07-03 18:54:50 +02:00
Dave Collins
0e463baf95 goimports -w . 2014-07-02 19:34:05 -05:00
Josh Rickmar
130edaec65 Add ListLockUnspent support.
Closes #11.

ok @davecgh
2014-06-30 10:30:11 -05:00
Josh Rickmar
4c045cc1ec Add LockUnspent support.
Closes #10.

ok @davecgh
2014-06-30 10:30:10 -05:00
GeertJohan
f1bfb5dc1c Add ImportPrivKey versions with Label and Rescan arguments. 2014-06-28 23:34:38 -05:00
Dave Collins
894d5e23aa Unmarshal the SubmitBlock error.
The string needs to be unmarshaled rather than returned directly otherwise
it will have an extra set of quotes plus it's safter to properly unmarshal
it.

Pointed out by @jrick.
2014-06-26 21:47:43 -05:00
Dave Collins
0f6726b9c3 Add missing import. 2014-06-26 20:24:40 -05:00
Dave Collins
cb67972512 Detect error strings on SumitBlock.
The submitblock RPC returns a string containing an error if it failed for
any reason.  This comment detects a non-null return from submitblock and
converts that string to an error which is returned.
2014-06-26 18:04:01 -05:00
Dave Collins
a9e1b8fb84 Use system CAs when Certificates are not specified.
This commit modifies the TLS setup to only override the RootCAs for the
TLS connection if certificates are specified.  This allows the
Certificates parameter to be ommitted from the connection config to use
the system CAs.
2014-06-25 21:53:00 -05:00
David Hill
0ae3676a7d Log when the initial connection has been made. 2014-06-25 12:56:47 -04:00
Josh Rickmar
22b6af1400 Fix unmarshaling of HTTP POST responses.
If connecting to a bitcoin RPC server as an HTTP POST client, full
response objects rather than just the raw result bytes were being
passed to the specific result unmarshalers, causing unmarshal errors
for the incorrect JSON types.  To fix this, first unmarshal the
response body into a rawResponse, and pass only the raw result bytes
(or an error) to the specific handlers.

This was reported by nskelsey on IRC.

ok @davecgh
2014-06-18 10:21:18 -05:00
Josh Rickmar
aceaed82c5 Add support for new rescanfinished notification.
ok @davecgh
2014-06-16 14:45:47 -05:00
Dave Collins
7448f9555c Make golint happier. 2014-06-12 23:00:03 -05:00
Dave Collins
67d570e660 Correct a few cases of address encoding.
There are certain RPCs where an address should be sent as the raw string
instead of the encoded bitcoin address since the RPC handler on the other
end expects "keys" instead of Bitcoin addresses.

For example, the multisignature RPCs addmultisigaddress and createmultisig
can work with pubkeys (compressed, uncompressed, or hybrid) as well as
Bitcoin addresses.

The original issue which prompted these changes was report by Paul Snow on
IRC.
2014-06-12 22:55:30 -05:00
Josh Rickmar
28c0a3c8c7 Modify doco and example for btcwallet ws endpoint. 2014-06-12 13:00:42 -05:00
Josh Rickmar
4ac778d72a Do not reissue rescan requests on reconnect. 2014-06-12 11:38:22 -05:00
Josh Rickmar
cfb46e2c43 Add getinfo support. 2014-06-11 16:38:54 -05:00
Josh Rickmar
1ec6dde39c Add custom/raw request/response support. 2014-06-11 16:38:54 -05:00
Josh Rickmar
793e66c785 Add callback for connects and reconnects. 2014-06-11 16:38:54 -05:00
Dave Collins
8e624b20a9 Switch to conformal vendoring of Gorilla websocket. 2014-06-07 01:06:11 -05:00
Dave Collins
1602463681 Don't split up the group for debuglevel functions. 2014-06-05 23:57:05 -05:00
Dave Collins
7eea8252a4 Add the new example to README.md and doc.go. 2014-06-05 20:58:47 -05:00
Dave Collins
cd4018b33e Add btcwallet websocket example.
Reviewed by @jrick who also provided some comment and terminology
improvements.
2014-06-05 20:40:45 -05:00
Michalis Kargakis
e31398a272 Add height parameter in disconn notification 2014-06-05 20:48:56 +03: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
879a125a2f Update CONTRIBUTORS. 2014-06-02 09:50:03 -05:00
kargakis
a785ef6424 minor syntax fixes 2014-06-02 17:31:02 +03:00
Josh Rickmar
67e94bcaaa Add createencryptedwallet extension support. 2014-05-28 11:33:28 -05:00
Dave Collins
0c586634bd Update for recent btcutil API changes. 2014-05-27 17:03:09 -05:00
Dave Collins
6af13826ae Convert {Dump,Import}PrivKey to use new WIF type.
The btcutil package recently exposed a WIF type to provide more
functionality and simplify working with WIF strings.  This commit changes
the DumpPrivKey and ImportPrivKey RPCs to use the new WIF type.
2014-05-21 20:00:11 -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
Dave Collins
57738b1920 gofmt 2014-05-21 19:24:45 -05:00
Josh Rickmar
85886913b8 Implement Client methods for listunspent requests. 2014-05-12 16:43:30 -05:00
Dave Collins
267cf94edc Correct typo in example log statement. 2014-05-11 13:30:25 -05:00
Dave Collins
e230b54427 Correct FutureGetBestBlockResult.Receive type.
Also correct the error message while here.
2014-05-11 02:35:07 -05:00
Dave Collins
e2ba50eee1 Fix a couple of typos in README.md. 2014-05-10 15:48:14 -05:00