Commit Graph

521 Commits

Author SHA1 Message Date
Nadav Ivgi
44066d6321 Store block metadata in database
So that we don't have to fetch and parse the entire block to get it.

The metadata includes the block size, the number of transactions,
and the sum of transactions weights.

The `GET /blocks` and `GET /block/:hash` endpoints use the new metadata
and no longer have to fetch blocks from bitcoind.

The only remaining endpoint that talks to bitcoind is GET /block/:hash/txs.

(cherry picked from commit 8ff218d3400a65c2ca3225a8337f9f9d72e0115e)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
89a897beb0 Separate endpoint for transaction hex
(cherry picked from commit 600f13342a1dd4fbf2a27e996b21d5c5d9dcde3d)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
77559fc4f5 Remove block cache 2018-10-26 22:17:18 +02:00
Nadav Ivgi
bdbf22762e Add number of confirmations to GET /block/:hash 2018-10-26 22:17:18 +02:00
Nadav Ivgi
95a9723ee8 Change /block/:hash/with-txs to /block/:hash/txs
Returns just the txs, without block header information.

(cherry picked from commit 5d910901f672a53a684a184cfb06b1ba6fe47678)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
304fcf6a97 Don't return a prevblockhash for the genesis block
Used to return "0000000..." as the prevblockhash, now returns a null.

(cherry picked from commit 22522e1ac74abdfdfef716f9988e80165e580130)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
24f30780c0 Implement raw transaction store
Add txid->rawtx store, using 't' as the database prefix,
and a query.txstore_get() method to fetch txs from it.

Used for processing GET /tx/:txid requests, as well as for fetching the
prevout txs of inputs. Not used by electrs internally elsewhere or for the
Electrum server, which still fetch via the block height index and bitcoind.

Information about the confirmation status of transactions was removed from
REST API responses, since it is volatile and cannot be determined from the
rawtx index alone. This will be reintroduced as a separate endpoint.

(cherry picked from commit f4badf9834d42ad5a12aa96c5ee3c7fcfd198602)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
81f8cee7bc Redirect /block-height/:height to /block/:hash
and deprecate /block-height/:height/with-txs

(cherry picked from commit febe5b86b7e2d5b66cf407c3d7179f927b8f9033)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
70f4ae555d Add http_message utility, set CORS on errors
(cherry picked from commit 6e9825484f7911c46a190f1916fe1739fba44d48)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
70a7994201 Support unconfirmed txs in GET /tx/:txid 2018-10-26 22:17:18 +02:00
Nadav Ivgi
2f1b90155f Mark fee outputs with scriptpubkey_type = "fee"
Plus some refactoring to avoid mutation.
2018-10-26 22:17:18 +02:00
Nadav Ivgi
3701a3d782 Add prevout to transaction inputs 2018-10-26 22:17:18 +02:00
Nadav Ivgi
48e0013e58 Add scriptpubkey_address to transaction outputs 2018-10-26 22:17:18 +02:00
Nadav Ivgi
8c3683bf7a Provide explicit asset id for unblinded outputs
or the commitment as vout.assetcommitment when blinded
2018-10-26 22:17:18 +02:00
Riccardo Casatta
07d0997090 fix script type name, add with-txs to block-heigth, add prevhash
(cherry picked from commit 00720e15fcc5b8df8ed2dbfd3396ac3bde5ef4eb)
2018-10-26 22:17:18 +02:00
Riccardo Casatta
8e181d5391 add liquidv1 2018-10-26 22:17:18 +02:00
Riccardo Casatta
dd02e195b4 handle absence of values in json from rpc 2018-10-26 22:17:18 +02:00
Riccardo Casatta
675a0f6ce8 use reorg 2018-10-26 22:17:18 +02:00
Riccardo Casatta
0342cbeeaa add initial naive error handling 2018-10-26 22:17:18 +02:00
Riccardo Casatta
31604340ac script type 2018-10-26 22:17:18 +02:00
Riccardo Casatta
0c619ee63e block by height 2018-10-26 22:17:18 +02:00
Riccardo Casatta
a02f6d463e add hex and asm for output 2018-10-26 22:17:18 +02:00
Riccardo Casatta
d3c3f8ff53 add explicit value if it's not confidential 2018-10-26 22:17:18 +02:00
Riccardo Casatta
b5ec1ae58b always giving size and weight in tx, added asm 2018-10-26 22:17:18 +02:00
Riccardo Casatta
3f35d8398c add confirmation in block summary 2018-10-26 22:17:18 +02:00
Riccardo Casatta
498c0015de add with txs and is_coinbase 2018-10-26 22:17:18 +02:00
Riccardo Casatta
2b8181b076 add redundancy 2018-10-26 22:17:18 +02:00
Riccardo Casatta
28b20b4a12 allow cors 2018-10-26 22:17:18 +02:00
Riccardo Casatta
28c8eddf3f txs endpoint 2018-10-26 22:17:18 +02:00
Riccardo Casatta
b4d6badee9 lru cache blocks 2018-10-26 22:17:18 +02:00
Riccardo Casatta
889eeff7d5 fix bug in gettransaction_raw for elements rpc 2018-10-26 22:17:18 +02:00
Riccardo Casatta
236892f4fe other api endpoints 2018-10-26 22:17:18 +02:00
Riccardo Casatta
b64762e080 init rest server 2018-10-26 22:17:18 +02:00
Riccardo Casatta
51896c9e52 add get block from height 2018-10-26 22:17:18 +02:00
Riccardo Casatta
f415c897cb add get block and query examples 2018-10-26 22:17:18 +02:00
Riccardo Casatta
48bca56e84 support liquid 2018-10-26 22:17:18 +02:00
Roman Zeyde
c86245751e
Remove unneeded locking from MempoolStore 2018-10-21 23:33:58 +03:00
Roman Zeyde
42ab247776
Use LRU cache (instead of an unbounded HashMap) for transaction caching 2018-10-17 11:46:49 +03:00
Roman Zeyde
cb724352bc
Fix small typo in comment 2018-10-14 23:21:31 +03:00
Roman Zeyde
1dcc8ac575
Don't run full compaction after initial import is over 2018-10-14 10:58:48 +03:00
Roman Zeyde
c2563701eb
Group 'use' statements 2018-10-06 21:31:43 +03:00
Roman Zeyde
e300796fc2
Add scanning DBStore prefix iterator 2018-10-01 21:15:11 +03:00
Roman Zeyde
f27b1428b1
Add a small comment to test caching 2018-09-28 11:42:34 +03:00
Roman Zeyde
71347c1568
Simplify status queries by using itermediate variables 2018-09-27 17:01:41 +03:00
Roman Zeyde
3f51458fee
Optimize for low-memory systems by using different RocksDB settings
- Keep less open files (to preserve memory)
- Don't use compaction readahead
- Use smaller SSTable block size
2018-09-16 09:55:42 +03:00
Roman Zeyde
200ef16ed0
Expose low-memory indexing via --jsonrpc-import flag
(instead of --skip_bulk_import)
2018-09-16 09:55:42 +03:00
Roman Zeyde
18d2aef052
Re-format using Rust 1.29 2018-09-14 16:35:18 +03:00
Roman Zeyde
58ea2ed960
Allow higher concurrency for >dual core machines 2018-09-07 18:08:36 +03:00
Roman Zeyde
853513ed27
Add 'blockchain.address.get_history' API
For easier invocation (e.g. using curl).
2018-09-03 12:04:28 +03:00
Roman Zeyde
27ce8ca0ab
Handle disconnections during reading RPC response
Make sure that the read data has the same size as the "Content-Length" header.
2018-09-02 15:07:21 +03:00