Commit Graph

74 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
1696c63888
Merge pull request #1844 from chappjc/getnewaddress-rpcclient-revert
rpcclient: add getnewaddresstype and revert breaking change
2022-06-06 16:08:50 -07:00
Andras Banki-Horvath
97313ac873
rpcclient: save the last error when retrying 2022-05-13 15:35:14 +02:00
Andras Banki-Horvath
9babf1fa08
rpcclient: fix backoff logic
This commit removes Sleep() from the rety handler so that the shutdown
request is always respected. Furthermore the maximum retry count is corrected.
2022-05-13 15:35:14 +02:00
Andras Banki-Horvath
966511246d
rpclient: fix masked error causing crash after max retries
This commit fixes the error that is masked inside the for loop's scope.
Previously after max retries the error didn't leave the for scope and
therefore httpResponse remained nil which in turn resulted in a crash.
2022-05-13 15:35:13 +02:00
Andras Banki-Horvath
ebed1927bf
rpcclient: fix formatting 2022-05-13 15:35:09 +02:00
Jonathan Chappelow
788fb8faf8 rpcclient: add getnewaddresstype and revert breaking change
This reverts the previous breaking change to the GetNewAddress and
GetRawChangeAddress rpcclient.Client methods, and adds the methods
GetNewAddressType and GetRawChangeAddressType for requesting
an address of a certain type.  This change allows the rpcclient package
to continue to work with versions of the btcwallet app that do not
recognize the address type parameter.
2022-04-14 11:25:56 -05:00
Torkel Rogstad
85b6f7ed2a rpcclient: add getzmqnotifications RPC 2022-04-09 07:46:07 -04:00
Jonathan Chappelow
7eaf360063 btcjson: add addresstype arg to getrawchangeaddress 2022-04-09 07:38:57 -04:00
Jonathan Chappelow
061aef98af btcjson: add addresstype arg to getnewaddress 2022-04-09 07:38:57 -04:00
Olaoluwa Osuntokun
caac0f821a
multi: update btcutil imports to point to new sub-module
In this commit, we update all the btcutil imports to point to the new
sub-module.

In the same commit, we also modify the recently added `btcutil/go.mod`
file as we need to continue pointing to the _old_ version of btcd, until
we merge this PR and push a new tag.
2022-01-10 18:44:58 -08:00
Matthew Bajorek
ec9ca7d782 rpcclient+rpcserver: Change getnetworkhashps return type to be a float to be in line with bitcoin core 2021-12-14 10:05:52 -05:00
3nprob
cc7327c194 rpcclient: Add retry with backoffs to HTTP POST requests
Adds behavior similar to the retries of persistent RPC connections
to HTTP request.

* Initial backoff: 500ms
* Linear increase
* Max retries: 10

Room for future improvement:
* Make configurable
* Add jitter
* Tests for retry behavior
2021-11-16 09:08:07 -05:00
JeremyRand
3e2d8464f1
rpcclient: Export symbols needed for custom commands (#1457)
* rpcclient: Export sendCmd and response

This facilitates using custom commands with rpcclient.

See https://github.com/btcsuite/btcd/issues/1083

* rpcclient: Export receiveFuture

This facilitates using custom commands with rpcclient.

See https://github.com/btcsuite/btcd/issues/1083

* rpcclient: Add customcommand example

* rpcclient: remove "Namecoin" from customcommand readme heading
2021-09-02 08:39:55 +02:00
Jake Sylvestre
540786fda6 rpcclient: fix documentation typo 2021-04-13 09:09:20 -04:00
Jake Sylvestre
d08785547a docs: update shields 2021-03-05 07:45:19 -05:00
Jake Sylvestre
2a1aa5129e Add Batch JSON-RPC support (rpc client & server) 2021-02-09 09:47:46 -05:00
10gic
610bb55ae8 rpcclient: add ExtraHeaders in ConnConfig 2020-11-24 14:15:14 -05:00
Armando Ochoa
f070f7f2be rpcclient: fix documentation typos 2020-11-04 09:56:02 -05:00
Anirudha Bose
535f25593d rpcclient: implement createwallet with functional options 2020-10-26 14:54:05 -04:00
Torkel Rogstad
1d75e0a885 rpcclient: add more wallet commands
Implement backupwallet, dumpwallet, loadwallet and unloadwallet.
2020-10-26 09:34:56 -04:00
Anirudha Bose
6519c04a6f rpcclient: implement gettxoutsetinfo command 2020-10-05 10:03:47 -04:00
Henry Fisher
584c382334 rpc: add signrawtransactionwithwallet interface
Adds interface for issuing a signrawtransactionwithwallet command.
Note that this does not add functionality for the btcd rpc server
itself, it simply assumes that the RPC client has this ability and gives
an API for interacting with the RPC client.

rpc: add signrawtransactionwithwallet interface
2020-10-05 09:56:12 -04:00
Anirudha Bose
e9a51e8dcd rpcclient: implement getwalletinfo command 2020-09-25 12:18:06 -04:00
Anirudha Bose
ac3f235eb9 rpcclient: implement getaddressinfo command
Fields such as label, and labelspurpose are not included, since they
are deprecated, and will be removed in Bitcoin Core 0.21.
2020-09-21 09:47:58 -04:00
Elliott Minns
6daaf73544
GetBlockTemplate RPC client implementation (#1629)
* GetBlockTemplate RPC client implementation

* Txid added to the getblocktemplate result

* Omitempty for TxID and improved comment for GetBlockTemplate 'rules' field
2020-09-21 09:42:35 -04:00
Anirudha Bose
c693bd8bc5 rpcclient: add deriveaddresses RPC command 2020-09-14 10:30:47 -04:00
Andrew Tugarinov
5ae1f21cd9 Added ListSinceBlockMinConfWatchOnly method. 2020-09-14 09:48:40 -04:00
Federico Bond
6f49f1f194 btcjson,rpcclient: add support for PSBT commands to rpcclient 2020-09-14 09:37:27 -04:00
Mikael Lindlof
fff96610aa rpc: Add getnodeaddresses JSON-RPC support
Add NodeAddresses function to rpcserverConnManager
interface for fetching known node addresses.
2020-09-14 09:36:05 -04:00
Anirudha Bose
ba3fe57507
rpcclient: support listtransactions RPC with watchonly argument
Co-authored-by: Gert-Jaap Glasbergen <gertjaap@decoscrypto.com>
2020-09-08 09:43:02 -04:00
Anirudha Bose
fffe4a909b rpcclient: Implement importmulti JSON-RPC client command 2020-08-31 15:28:48 -04:00
Mikael Lindlof
b68c50e33c Add getblockfilter JSON-RPC client command
Add type for second getblockfilter param
2020-08-31 10:02:54 -04:00
Anirudha Bose
efae8e9967 Add rpclient implementation of getdescriptorinfo RPC 2020-08-31 09:41:49 -04:00
Anirudha Bose
e2d9cf4b55 rpcclient: Add GetTransactionWatchOnly method 2020-06-29 10:15:10 -04:00
Federico Bond
7b2ff5d180 Add getbalances RPC client command 2020-06-29 10:14:04 -04:00
Torkel Rogstad
e4f59022a3 Add fundrawtransaction RPC call 2020-06-15 09:44:04 -04:00
Mikael Lindlof
73d69f09d0 Add getchaintxstats JSON-RPC client command 2020-06-15 09:42:37 -04:00
Torkel Rogstad
714de3f3c7 rpcclient: serialize nil inputs to empty list 2020-06-08 09:52:46 -04:00
JeremyRand
6d521ff8cd rpcclient: Read first line of cookie instead of trimming space 2020-06-08 09:51:09 -04:00
JeremyRand
e6f163e61e rpcclient: Try user+pass auth before cookie auth 2020-06-08 09:51:09 -04:00
JeremyRand
915788b8e6 rpcclient: Refactor cookie caching 2020-06-08 09:51:09 -04:00
JeremyRand
280845a8a4 rpcclient: Add cookie auth
Based on Hugo Landau's cookie auth implementation for Namecoin's ncdns.

Fixes https://github.com/btcsuite/btcd/issues/1054
2020-06-08 09:51:09 -04:00
Wilmer Paulino
742935e3a9
rpcclient: send legacy GetBlock request for backwards compatibility
Without this, users of this library wouldn't be able to issue GetBlock
requests to nodes which haven't updated to support the latest request
format, namely the use of a single `int` parameter to denote verbosity
instead of two `bool`s.
2020-05-14 18:05:46 -07:00
Henry
d38279ee74
btcjson: change getblock default verbosity to 1
This change makes btcd's getblock command match bitcoind's. Previously
the default verbosity was 0, which caused errors when using the
rpcclient library to connect to a bitcoind node - getblock would
unmarshall incorrectly since it didn't expect a verbosity=1 result when
it did not specify verbosity.
2020-05-14 17:27:59 -07:00
Torkel Rogstad
57d44d022e Try both TX serialization formats 2020-03-27 16:59:23 -04:00
Ivan Kuznetsov
cfcf4fb762 Implement 'getblockstats' JSON-RPC command 2020-03-25 05:51:42 -04:00
Torkel Rogstad
8b1be46463 Add generatetoaddress and estimatesmartfee RPCs 2020-03-17 09:29:41 -04:00
Iskander Sharipov
d9ce6b037f btcjson,rpcclient: use proper Deprecated comment format
This makes godoc and other Go tools understand deprecation notice.

Found using https://go-critic.github.io/overview#deprecatedComment-ref
2020-03-10 11:00:24 -04:00
Jake Sylvestre
c4f39996ac
Refactor GetBlockVerboseTx to reflect correct getblock RPC call… (#1529)
Refactor GetBlockVerboseResult into two separate types: one type for getblock "hash" verbosity=1,
and a second type for getblock "hash" verbosity=2. This is necessary due to how getblock returns
a block's transaction data based on the provided verbosity parameter.

If verbosity=1, then getblock.Tx is an array of a block's transaction ids (txids) as strings.
If verbosity=2, then getblock.Tx is an array of raw transaction data.

Due to differences in how getblock returns data based on the provided verbosity parameter, it's necessary
to have two separate return types based on verbosity. This necessitates a separate unmarshalling function
(represented throughout rpcclient/chain.go as Result.Receive()) to ensure that data is correctly unmarshalled
and returned to the user.
2020-03-09 14:47:11 -04:00
John C. Vernaleo
e9f15eda7e
rpcclient: Add net params to Client (#1467)
* rpcclient: replace futures mainnet with params

Adds a chaincfg.Params to the Client

rpcclient: parse config to assign params

* rpcclient: change address commands to Address

 * Change address future struct to contain a network field, so futures
   can return the correct type for Receive
2020-03-05 16:46:29 -05:00