Commit graph

3361 commits

Author SHA1 Message Date
Anirudha Bose
7145eef75b rpcserver: add parity with bitcoind for validateaddress
Updated the rpcserver handler for validateaddress JSON-RPC command to
have parity with the bitcoind 0.20.0 interface.

The new fields included are - isscript, iswitness, witness_version, and
witness_program. The scriptPubKey field has been left out since it
requires wallet access.

This update has no impact on the rpcclient.ValidateAddress method,
which uses the btcjson.ValidateAddressWalletResult type for modelling
the response from bitcoind.
2020-08-31 09:58:27 -04:00
wakiyamap
36d4ae08e8 Fix monetary unit 2020-08-31 09:56:19 -04:00
Olaoluwa Osuntokun
7d69fb9ba6 peer: prevent last block height going backwards
This modifies the UpdateLastBlockHeight function to ensure the new
height is after the existing height before updating it in order to
prevent it from going backwards so it properly matches the intent of the
function which is to report the latest known block height for the peer.

Without this change, the value will properly start out at the latest
known block height reported by the peer during version negotiation,
however, it will be set to lower values when syncing from the peer due
to requesting old blocks and blindly updating the height.

It also adds a test to ensure proper functionality.

This is a backport of https://github.com/decred/dcrd/pull/1747
2020-08-31 09:47:41 -04:00
Anirudha Bose
efae8e9967 Add rpclient implementation of getdescriptorinfo RPC 2020-08-31 09:41:49 -04:00
Rjected
70a0132485 blockchain: remove unknown block version warning 2020-08-31 02:42:30 -04:00
John C. Vernaleo
56cc42fe07 btcd: bump version to v0.21.0-beta 2020-08-28 08:13:36 -04:00
Anirudha Bose
4527c5671f Update CHANGES file for 0.21.0 release
Also updated changes for 0.20.1, and added a small note about changes
since 0.12.0.
2020-08-27 15:26:14 -04:00
Dan Cline
2a0d6fd0e3 release: remove old scripts and update process doc
- remove prep_release.sh and notes.sample
- update license in release.sh
- add notes for maintainers on the release process
- mention CHANGES file modifications
2020-08-27 15:14:38 -04:00
Dan Cline
4255e1ed7b release: update release script path 2020-08-27 15:14:38 -04:00
Olaoluwa Osuntokun
1db1b6f821
Merge pull request #1609 from guggero/disable-windows-service
config+service_windows: add flag to disable win service
2020-07-30 16:23:43 -07:00
Javed Khan
24db7d7c0c netsync: handle notfound messages from peers
backport from https://github.com/decred/dcrd/pull/2253

When a peer sends a notfound message, remove the hash from requested
map.  Also increase notfound ban score and return early if it
disconnects the peer.
2020-07-28 09:23:35 -04:00
qqjettkgjzhxmwj
69773a7b41 Update json_rpc_api.md
Corrections suggested by @onyb https://github.com/btcsuite/btcd/pull/1608#discussion_r458363077
2020-07-22 17:12:47 -04:00
qqjettkgjzhxmwj
3c56a6bd3a updated docs for getblock-verbosity fixes 2020-07-22 17:12:47 -04:00
Oliver Gugger
c7390232d3
config+service_windows: add flag to disable win service
To run integration tests with btcd on Windows in non-interactive
environments (such as the Travis build with Windows machines), we
need to make sure we can still spawn a child process instead of only a
windows background service.
2020-07-22 12:57:09 +02:00
Anirudha Bose
d28c7167a5 btcec: Avoid panic in fieldVal.SetByteSlice for large inputs
The implementation has been adapted from the dcrec module in dcrd. The
bug was initially fixed in decred/dcrd@3d9cda1 while transitioning to a
constant time algorithm. A large set of test vectors were subsequently
added in decred/dcrd@8c6b52d.

The function signature has been preserved for backwards compatibility.
This means that returning whether the value has overflowed, and the
corresponding test vectors have not been backported.

This fixes #1170 and closes a previous attempt to fix the bug in #1178.
2020-07-13 09:43:36 -04:00
Javed Khan
875b51c9fb peer: knownInventory, sentNonces - use generic lru
While here, also rename and generalize limitMap and apply to
other maps which need to be bounded.
2020-07-08 16:44:04 -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
adiabat
a383a71670 Add blockchain.NewUtxoEntry() to directly create entries for UtxoViewpoint
The current methods to add to a UtxoViewpoint don't allow for a situation where
we have only UTXO data but not a whole transaction.  This commit allows
contstruction of a UtxoEntry without requiring a full MsgTx.

AddTxOut() and AddTxOuts() both require a whole transaction, including the inputs,
which are only used in order to calculate the txid.  In some situations, such as
with use of the utreexo accumulator, we only have the utxo data but not the
transaction which created it.

For reference, utreexo's initial usage of the blockchain.NewUtxoEntry() function is at
https://github.com/mit-dci/utreexo/pull/135/files#diff-3f7b8f9991ea957f1f4ad9f5a95415f0R96
2020-06-15 09:40:26 -04:00
Mikael Lindlof
b11bf582c5 Improve chain state init efficiency
Remove unnecessary slice of all block indexes and
remove DB iteration over all block indexes that
used to determined the size of the slice.
2020-06-08 12:53:00 -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
Olaoluwa Osuntokun
9f0179fd2c
Merge pull request #1577 from wpaulino/getblock-compat
rpcclient: send legacy GetBlock request for backwards compatibility
2020-05-15 16:24:29 -07:00
Olaoluwa Osuntokun
9a88e1dd33
Merge pull request #1575 from dajohi/clean
build: multiple cleanups
2020-05-15 15:47:01 -07: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
David Hill
f7399e6157 build: clean linter warnings 2020-05-13 08:58:39 -04:00
David Hill
bc8d63bf15 build: update deps 2020-05-13 08:52:05 -04:00
David Hill
a505b99ba3 build: replace travis-ci with github actions.
test go 1.14
use golangci-lint
2020-05-13 08:52:05 -04:00
Dan Cline
b470eee477 btcctl: add regtest mode to btcctl 2020-05-13 08:02:20 -04:00
Antonin Hildebrand
b298415583 Improve error message about non-active segwit on simnet
I started playing with simnet and was confronted with error message:

```
[ERR] FNDG: Unable to broadcast funding tx for ChannelPoint(<point>:0):
-22: TX rejected: transaction <tx> has witness data, but segwit isn't active yet
```

I wasn't aware of the activation period so I got quite puzzled.
Google helped. But I think the message could mention likely cause.

Newly it optionally prints something like:

```
(The threshold for segwit activation is 300 blocks on simnet, current best height is 113)
```
2020-05-13 08:00:49 -04:00
tpkeeper
8512affc59 readme: remove duplicate word 2020-05-06 08:32:44 -04:00
Dan Cline
8b54b0b964 config.go: remove extra quotes 2020-04-14 06:40:20 -05:00
Murray Nesbitt
9f15a7e6af Alphabetize --help output; add missing options to doc.go 2020-04-14 05:09:43 -05:00
Torkel Rogstad
57d44d022e Try both TX serialization formats 2020-03-27 16:59:23 -04:00
Iskander Sharipov
08b8751559 cmd/btcctl: use regexp.MustCompile for constant patterns
Found using https://go-critic.github.io/overview#regexpMust-ref
2020-03-26 09:54:27 -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
Jake Sylvestre
a8eadd2ce4 update GetMempoolEntryResult to v0.19.0
https://bitcoincore.org/en/doc/0.19.0/rpc/blockchain/getmempoolentry/
2020-03-16 10:26:15 -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
Daniel McNally
fd0921b9b4 btcjson: add RPC_IN_WARMUP error code
This adds an error code for the `RPC_IN_WARMUP` error code defined at
https://github.com/bitcoin/bitcoin/blob/master/src/rpc/protocol.h#L49
which is thrown when bitcoind has started but has not yet finished
verifying recent blocks and being ready for rpc calls.
2020-03-09 13:43:01 -04:00
Jin
96f3808dc9 BUG:dynamicbanscore deadlock 2020-03-09 13:41:13 -04:00
Steven Roose
9e94ccbd0e server: Fix incorrect log message format 2020-03-05 17:00:45 -05:00
Tyler Chambers
1d0bfca5b0 fix error message 2020-03-05 16:51:41 -05:00