Commit Graph

703 Commits

Author SHA1 Message Date
Nadav Ivgi
e8fd84371a Detect config changes and require a reindex 2018-11-19 08:03:47 +02:00
Nadav Ivgi
c6c29787a6 Only attach prevout to inputs when "prevout_enabled" is set 2018-11-19 08:01:29 +02:00
Nadav Ivgi
8195475204 Implement bitcoind-based fallbacks for load_txn, get_block_meta and get_block_txids 2018-11-19 08:00:47 +02:00
Nadav Ivgi
9827512c39 Implement optional indexes in indexer 2018-11-19 07:55:16 +02:00
Nadav Ivgi
344083da74 Add new configuration options 2018-11-19 07:34:56 +02:00
Nadav Ivgi
bee94a54b9 Make config available for query and indexer 2018-11-19 07:34:56 +02:00
Nadav Ivgi
11b14f5c45
Merge pull request #5 from romanz/bitcoin_e
Run 'cargo +stable fmt --all'
2018-11-19 07:02:52 +02:00
Nadav Ivgi
7da4e0aa1d
Merge pull request #3 from romanz/fix-unconfirmed-txns-height
Sort transaction history by descending confirmation height
2018-11-19 03:46:10 +02:00
Roman Zeyde
2a42e1e7d0
Run 'cargo +stable fmt --all' 2018-11-18 14:39:11 +02:00
Roman Zeyde
953abaf330
Sort transaction history by descending confirmation height
Now unconfirmed txns use u32::max_value as their height.

Also, remove Electrum-specific hash from query module.
2018-11-18 12:04:24 +02:00
Roman Zeyde
cf2e79e7db
Use u32::max_value() for mempool transactions' height at mempool.rs
So mempool transactions will appear at the end of the scripthash status:
https://electrumx.readthedocs.io/en/latest/protocol-basics.html#status
2018-11-18 11:54:40 +02:00
Roman Zeyde
3f2e3ed106
Use u32 internally for transaction height (instead of usize) 2018-11-18 11:53:18 +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 a328d93ff1)
2018-11-11 00:26:39 +02:00
Nadav Ivgi
32239bd7f5 Fix typo
(cherry picked from commit e82c904f26)
2018-11-08 02:29:11 +02:00
Nadav Ivgi
de411ffd9d Don't encode p2pk addresses
(cherry picked from commit 1e2dbec653)
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 33397c21bb
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 b486c4ddc4)
2018-10-29 19:58:01 +02:00
Nadav Ivgi
0284eaafb7 Don't load spending txs of unspendable outputs
(cherry picked from commit 7534bff544)
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