Commit graph

49 commits

Author SHA1 Message Date
Brannon King 5116f45617 [lbry] rpc: fix getblock reponse 2022-05-24 00:01:45 -07:00
Brannon King 3d8f36a505 [lbry] rpc: output segwit rule 2022-05-24 00:01:45 -07:00
Brannon King 6834591d52 [lbry] rpc: support claim related methods 2022-05-23 23:53:30 -07:00
Roy Lee 45627c7a6a [lbry] rename btcd to lbcd
Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00
Roy Lee 3dc91f1295 [lbry] blockchain, wire: add ClaimTrie to Block Header 2022-05-23 23:53:29 -07:00
Aurèle Oulès 2d7825cf70 btcjson: Updated TxRawResult.Version from int32 to uint32 2021-04-13 15:21:09 -04:00
Steven Kreuzer 7bbd9b0284 btcjson: Update fields in GetBlockChainInfoResult
Update the fields of GetBlockChainInfoResult to reflect the current state of
the RPC returned by other full-node implementations.

 * InitialBlockDownload - Node is in Initial Block Download mode if True.
 * SizeOnDisk - The estimated size of the block and undo files on disk.
2021-01-26 09:52:38 -05:00
Vinayak Borkar c3ece697da Fixes btcsuite/btcd#1653 2021-01-18 13:51:45 -05:00
Torkel Rogstad 1d75e0a885 rpcclient: add more wallet commands
Implement backupwallet, dumpwallet, loadwallet and unloadwallet.
2020-10-26 09:34:56 -04:00
David Mazary 6adfc07d1e Unmarshal hashes/second as float in GetMiningInfoResult 2020-10-26 09:33:28 -04:00
Anirudha Bose 6519c04a6f rpcclient: implement gettxoutsetinfo command 2020-10-05 10:03:47 -04:00
Anirudha Bose 0bf42f4476 rpcserver: add txid to getblocktemplate response 2020-10-05 09:55:45 -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
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
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 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
Anirudha Bose efae8e9967 Add rpclient implementation of getdescriptorinfo RPC 2020-08-31 09:41:49 -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
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
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
jalavosus 468154a052 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.
2020-03-05 06:47:38 -05:00
Wilmer Paulino 93a84aa014
btcjson: use correct json tag for Bip9SoftForkDescription.StartTime 2019-11-08 17:53:45 -08:00
Wilmer Paulino 266851e329
btcjson+rpcclient: support new unified softfork bitcoind format 2019-11-05 16:28:33 -08:00
preminem e3d3088b80 btcjson+rpc: expose a transaction's weight via RPC 2019-09-25 17:19:03 -07:00
Conner Fromknecht f696d49c49
btcjson/chainsvrresults: use int64 for verbose getblock[header] confs
This commit modifies the parsed fields in GetBlockVerbose
and GetBlockHeaderVerbose from a uint64 to an int64.
bitcoind will return -1 if the requested block is not in
the main chain, which causes a panic when trying to
serialize into a uint.
2018-08-15 21:02:33 -07:00
Dave Collins a59ac5b18f
multi: Rework utxoset/view to use outpoints.
This modifies the utxoset in the database and related UtxoViewpoint to
store and work with unspent transaction outputs on a per-output basis
instead of at a transaction level.  This was inspired by similar recent
changes in Bitcoin Core.

The primary motivation is to simplify the code, pave the way for a
utxo cache, and generally focus on optimizing runtime performance.

The tradeoff is that this approach does somewhat increase the size of
the serialized utxoset since it means that the transaction hash is
duplicated for each output as a part of the key and some additional
details such as whether the containing transaction is a coinbase and the
block height it was a part of are duplicated in each output.

However, in practice, the size difference isn't all that large, disk
space is relatively cheap, certainly cheaper than memory, and it is much
more important to provide more efficient runtime operation since that is
the ultimate purpose of the daemon.

While performing this conversion, it also simplifies the code to remove
the transaction version information from the utxoset as well as the
spend journal.  The logic for only serializing it under certain
circumstances is complicated and it isn't actually used anywhere aside
from the gettxout RPC where it also isn't used by anything important
either.  Consequently, this also removes the version field of the
gettxout RPC result.

The utxos in the database are automatically migrated to the new format
with this commit and it is possible to interrupt and resume the
migration process.

Finally, it also updates the tests for the new format and adds a new
function to the tests to convert the old test data to the new format for
convenience.  The data has already been converted and updated in the
commit.

An overview of the changes are as follows:

- Remove transaction version from both spent and unspent output entries
  - Update utxo serialization format to exclude the version
  - Modify the spend journal serialization format
    - The old version field is now reserved and always stores zero and
      ignores it when reading
    - This allows old entries to be used by new code without having to
      migrate the entire spend journal
  - Remove version field from gettxout RPC result
- Convert UtxoEntry to represent a specific utxo instead of a
  transaction with all remaining utxos
  - Optimize for memory usage with an eye towards a utxo cache
    - Combine details such as whether the txout was contained in a
      coinbase, is spent, and is modified into a single packed field of
      bit flags
    - Align entry fields to eliminate extra padding since ultimately
      there will be a lot of these in memory
    - Introduce a free list for serializing an outpoint to the database
      key format to significantly reduce pressure on the GC
  - Update all related functions that previously dealt with transaction
    hashes to accept outpoints instead
  - Update all callers accordingly
  - Only add individually requested outputs from the mempool when
    constructing a mempool view
- Modify the spend journal to always store the block height and coinbase
  information with every spent txout
  - Introduce code to handle fetching the missing information from
    another utxo from the same transaction in the event an old style
    entry is encountered
    - Make use of a database cursor with seek to do this much more
      efficiently than testing every possible output
- Always decompress data loaded from the database now that a utxo entry
  only consists of a specific output
- Introduce upgrade code to migrate the utxo set to the new format
  - Store versions of the utxoset and spend journal buckets
  - Allow migration process to be interrupted and resumed
- Update all tests to expect the correct encodings, remove tests that no
  longer apply, and add new ones for the new expected behavior
  - Convert old tests for the legacy utxo format deserialization code to
    test the new function that is used during upgrade
  - Update the utxostore test data and add function that was used to
    convert it
- Introduce a few new functions on UtxoViewpoint
  - AddTxOut for adding an individual txout versus all of them
  - addTxOut to handle the common code between the new AddTxOut and
    existing AddTxOuts
  - RemoveEntry for removing an individual txout
  - fetchEntryByHash for fetching any remaining utxo for a given
    transaction hash
2018-05-27 03:07:41 -05:00
Dave Collins 0b50802d52
btcjson/rpcserver: Encode witness stack as slice.
The modifies the encoding of witness stacks in JSON responses to use a
slice of strings instead of a single space-separated string for
compatibility with Core.
2017-08-30 03:05:35 -05:00
Olaoluwa Osuntokun 8b130ec4ea btcjson: update RPC calls to return segwit related data 2017-08-13 23:17:40 -05:00
Dave Collins 1fee394e08
btcjson: Update GetNetworkInfoResult.
This updates the GetNetworkInfoResult structure to include the latest
fields added to Core for compatibility purposes.

While here, also move the definitions of the subtypes for the result
before their use for consistency.
2017-05-18 09:12:05 -05:00
David Hill d9241e91a9 btcjson: Add getmempoolentry API 2017-02-01 11:54:51 -06:00
Olaoluwa Osuntokun ec1c93ecc0
btcjson: update the fields of GetBlockChainInfoResult
This commit updates the fields of GetBlockChainInfoResult to reflect
the current state of the RPC as widely implemented by other full-node
implementations.
2016-12-06 16:24:43 -08:00
David Hill 2e93ea6ca6 btcjson: Add versionHex to getblock[header] results
rpcserver:  Set versionHex in responses.
2016-12-02 12:49:02 -05:00
David Hill 2510baac35 btcd: support feefilter requests.
This only adds support for handling remote peer requests.
2016-11-03 14:47:30 -04:00
David Hill 07e1e308f1 rpc: Add localaddr and relaytxes to getpeerinfo 2016-10-19 19:58:50 -04:00
David Hill 403aaf5cf3 rpcserver: avoid nested decodescript p2sh addrs 2016-10-19 13:59:50 -05:00
Dave Collins eb882f39f8 multi: Fix several misspellings in the comments.
This commit corrects several typos in the comments found by misspell.
2016-02-25 11:17:12 -06:00
danda c7eaee6020 adds filteraddrs param to searchrawtransactions API 2015-11-15 15:30:13 -08:00
David Hill f862536929 btcjson: Add errors to InfoChainResult
The getinfo RPC will now include the errors attribute in the
result.
2015-10-09 14:32:53 -04:00
danda 43774fe6bb adds optional prevOut section to vin for searchrawtransactions api. See https://github.com/btcsuite/btcd/issues/485 2015-08-23 09:58:03 -07:00
David Hill a6c79c7a91 Implement getblockheader RPC.
This mimics Bitcoin Core commit 076badb60f33f0c32b035de220ca14c52a423a2a
2015-07-23 15:22:17 -04:00
David Hill 7cfa843832 Support getmempoolinfo. 2015-06-24 20:34:56 -04:00
Dave Collins a40058cd0e rpcserver: Omit empty getrawtransaction->confirmations.
This commit omits the confirmations field from the getrawtransactions
RPC result when it's 0.

Closes #420.
2015-05-06 13:33:42 -05:00
Dave Collins 9a658c2689 rpcserver: Omit empty getblock->nextblockhash.
This commit omits the nextblockhash field from the getblock RPC result
when there isn't one (i.e for current the tip).

Closes #416.
2015-05-04 10:38:40 -05:00
Dave Collins 6e402deb35 Relicense to the btcsuite developers.
This commit relicenses all code in this repository to the btcsuite
developers.
2015-05-01 12:00:56 -05:00
Dave Collins d8a4423b90 btcjson: Replace btcjson with version 2.
This commit removes the old and deprecated btcjsonv1 package, moves the
new version 2 package into its place, and updates all imports accordingly.
2015-05-01 00:43:09 -05:00
Renamed from btcjson/v2/btcjson/chainsvrresults.go (Browse further)