Commit graph

695 commits

Author SHA1 Message Date
Roman Zeyde
c51aac74f7
Trace Prometheus' metrics requests 2018-11-18 14:11:41 +02:00
Roman Zeyde
82c3ce270e
Add latency histogram metrics to query.rs 2018-11-18 13:53:10 +02:00
Roman Zeyde
5f8eb50b89
Add testnet benchmarking script 2018-11-18 10:47:17 +02:00
Roman Zeyde
3933469a79
Remove FUNDING_TXN_LIMIT limit for performance tests 2018-11-18 10:47:15 +02:00
Nadav Ivgi
e565419f84
Merge pull request #2 from romanz/unused-cache
Remove unused TransactionCache from query.rs
2018-11-18 05:50:43 +02:00
Nadav Ivgi
f32ea705c5
Merge pull request #1 from romanz/drop-electrum-jsonrpc
Drop Electrum JSON-RPC support
2018-11-18 05:50:25 +02:00
Roman Zeyde
a31e828976
Remove unused TransactionCache 2018-11-17 23:03:19 +02:00
Roman Zeyde
e02e57d916
Drop Electrum JSON-RPC support
It can be re-added later as a separate crate.
2018-11-17 22:50:28 +02:00
Nadav Ivgi
dde87da6f0 Match Electrum's merkle proof format
Not the format we need, but at least its a known format

(cherry picked from commit 9067911215991993d593bd18d9c94b9d21e32fbf)
2018-11-16 07:24:45 +02:00
Roman Zeyde
a91d45156c Run 'cargo +stable fmt --all' 2018-11-15 16:27:17 +02:00
Roman Zeyde
6e5ec37091 Update rust-bitcoin to 0.15.1 and re-generate Cargo.lock 2018-11-15 16:24:36 +02:00
Nadav Ivgi
fbc5ed63fa Fix transaction ordering 2018-11-14 23:32:08 +02:00
Nadav Ivgi
8fba51c5f2 Expose the block version, bits, nonce and merkle root 2018-11-14 23:04:39 +02:00
Nadav Ivgi
79d00326a4 Change query.get_merkle_proof() to take the block hash 2018-11-14 21:36:31 +02:00
Nadav Ivgi
004552e086 Use new blockhash=>txids index to fetch block txs
So that GET /block/:hash/txs won't depend on bitcoind.
2018-11-14 21:22:15 +02:00
Nadav Ivgi
32e96c137d Implement GET /tx/:txid/merkle-proof
This required keeping a map of blockhash=>txids in our database,
so that we don't need to query bitcoind for it.

GET /block/:hash/txids was also added along the way, based on the
new indexes.

Future work: make /block/:hash/txs use the new index as well.
This is the last endpoint still involving bitcoind.
2018-11-14 19:03:13 +02:00
Nadav Ivgi
56f5a8ea1e Reduce to 25 txs per page 2018-11-14 17:35:24 +02:00
Nadav Ivgi
64fdc164dd Always return status in /tx/:txid 2018-11-14 17:34:56 +02:00
Nadav Ivgi
bc4fb7e9e3 Add Cache-Control header based on confirmation depth 2018-11-13 11:06:34 +02:00
Nadav Ivgi
681ff1a0fe Add --http-addr option to configure the HTTP server listen address/port 2018-11-13 06:31:50 +02:00
Nadav Ivgi
46ec3b9a7b Grammar 2018-11-11 00:41:23 +02:00
Nadav Ivgi
3f894a9807 Refactor API paths and formats 2018-11-11 00:40:24 +02:00
Nadav Ivgi
4ecb354339 Remove unused imports
(cherry picked from commit a328d93ff14a61005bc2162a5bf864c651edcbdd)
2018-11-11 00:26:39 +02:00
Nadav Ivgi
32239bd7f5 Fix typo
(cherry picked from commit e82c904f2662371319eab16d4ddbcf5e35cbf93a)
2018-11-08 02:29:11 +02:00
Nadav Ivgi
de411ffd9d Don't encode p2pk addresses
(cherry picked from commit 1e2dbec653504703059e71082c4a9ca82df1b9a2)
2018-11-08 02:21:12 +02:00
Nadav Ivgi
02bf83c456 Format 2018-11-05 15:37:04 +02:00
Nadav Ivgi
2f7793ffa1 Don't error for addresses with too many txs, return a valid response with no txs info instead 2018-11-05 14:38:47 +02:00
Nadav Ivgi
a8c0501b15 Error handling refactoringg
- Introduce HttpError (replaces StringError)
- Return errors as Err()
- Hide internal errors, explicitly define which errors should be user-visible
2018-11-05 14:35:39 +02:00
Nadav Ivgi
97df9fb955 Don't send Access-Control-Allow-Origin
will be added by reverse proxies as needed
2018-10-30 22:53:56 +02:00
Lawrence Nahum
75006bfa44 invert initialblockdownload check 2018-10-29 21:31:08 +01:00
Nadav Ivgi
1eb95ce7ea Check initialblockdownload and accept verificationprogress if its close to 1 2018-10-29 22:00:54 +02:00
Nadav Ivgi
3d4b86e52b Pass around Config instead of just Network
To match the changes introduced by liquid_e in 33397c21bb4bed7326f868a49697d37c0ddddf21
and keep the two branches closer.
2018-10-29 20:17:52 +02:00
Nadav Ivgi
f89e56135f Wait for bitcoind to fully sync-up (verificationprogress==1) before starting the HTTP server
(cherry picked from commit b486c4ddc459066c755eb2f8d13f98183e7252f6)
2018-10-29 19:58:01 +02:00
Nadav Ivgi
0284eaafb7 Don't load spending txs of unspendable outputs
(cherry picked from commit 7534bff5445ee3cfa676c268dcae5028e3f4f28c)
2018-10-28 00:04:25 +03:00
Nadav Ivgi
0c7a6deea8 Only fetch as many txids as needed in order to know that there are too many.
And increase the limit to 100.
2018-10-27 18:37:26 +02:00
Nadav Ivgi
30c671d067 Implement endpoints for finding spending txs
GET /tx/:txid/outspends and GET /tx/:txid/outspend/:vout
2018-10-27 18:37:26 +02:00
Nadav Ivgi
20bd9484fe Only start HTTP server once when the index is fully synced
This also disables the Electrum RPC server, which we don't use.
2018-10-27 03:24:18 +02:00
Nadav Ivgi
a2a30cc3e5 Expose transaction input nSequence 2018-10-26 22:15:47 +02:00
Nadav Ivgi
8b3ba7fddd Change error message for too many txs 2018-10-26 22:15:47 +02:00
Nadav Ivgi
c4f623eb66 Implement GET /address/:addr/utxo 2018-10-26 22:15:47 +02:00
Nadav Ivgi
7e02177a9a Verify addresses are on the correct network 2018-10-26 22:15:47 +02:00
Nadav Ivgi
881f63689b Add total_received to addresses 2018-10-26 22:15:47 +02:00
Nadav Ivgi
c4883c8b95 Reply with StringError messages 2018-10-26 22:15:47 +02:00
Nadav Ivgi
effec7336f Reject addresses with too many funding txs 2018-10-26 22:15:47 +02:00
Nadav Ivgi
53f030ecd4 Initial implementation for address API
Added GET /address/:addr and GET /address/:addr/txs

This required some changes in electrs internals, to keep track of the
block hash associated with a txs (inside the now misnamed TxnHeight)
and to return full transaction objects and not just ids from load_txns_by_prefix.

Transactions are now always loaded from the txstore. The original load_txn()
mechanism and the tx_cache are retired.

TransactionValue may now also contain an optional "status" field, which
is populated for address txs (but not elsewhere).
2018-10-26 22:15:47 +02:00
Nadav Ivgi
26dc229e01 Expose txin witness when available 2018-10-26 22:15:47 +02:00
Nadav Ivgi
9676b8ca7c Expose transaction version and locktime
(cherry picked from commit 3037298ea40da3e428c4b1d24d3a0b1297fedbed)
2018-10-26 22:15:47 +02:00
Nadav Ivgi
0c1309404b Return the hash instead of redirecting in GET /block-height/:height 2018-10-26 22:15:47 +02:00
Nadav Ivgi
a4256253ed Replace /blocks/tip with /tip/height and /tip/hash
Instead of redirecting, we now return either the height or the hash directly.
2018-10-26 22:15:47 +02:00
Nadav Ivgi
ad74782f16 Avoid query string arguments
Instead, pass the start_height/start_index as part of the path.
This enables better caching under some configurations.

The per-page block limit is now fixed and no longer user configurable.

Plus some refactoring.
2018-10-26 22:15:47 +02:00