Commit Graph

724 Commits

Author SHA1 Message Date
Roman Zeyde
866e01667c Remove electrs-related examples
Today, their functionality can be achieved by the main binary (`electrs`).

(cherry picked from commit 80a1d83b15)
2018-11-24 18:01:45 +02:00
Roman Zeyde
31d5a4c6e8 Add simple pre-commit hook for running 'cargo fmt'
Inspired by https://github.com/mimblewimble/grin/pull/110

(cherry picked from commit 9e7bd29087)
2018-11-24 18:01:34 +02:00
Nadav Ivgi
0a51b0e2ab Run 'cargo +stable fmt --all' 2018-11-24 18:01:17 +02:00
Nadav Ivgi
35d43a01ff Use MEMPOOL_HEIGHT instead of 0, follow up to ae2e8a7996f072f2e073fa51f07d7aca9e0e21b4
(and rename the misnamed "out" to "spend")

(cherry picked from commit a329272054)
2018-11-24 17:58:35 +02:00
Roman Zeyde
c904c0e543 Add latency histogram metrics to query.rs
(cherry picked from commit a492fb83ab)
2018-11-24 17:55:50 +02:00
Nadav Ivgi
de4326e6f4 Run 'cargo +stable fmt --all' 2018-11-24 17:50:08 +02:00
Roman Zeyde
92e21d892c 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.

(cherry picked from commit 953abaf330)
2018-11-24 17:48:45 +02:00
Roman Zeyde
0b3f2d7c1b 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

(cherry picked from commit cf2e79e7db)
2018-11-24 17:46:47 +02:00
Roman Zeyde
3ab452fa51 Use u32 internally for transaction height (instead of usize)
(cherry picked from commit 3f2e3ed106)
2018-11-24 17:46:47 +02:00
Roman Zeyde
678630038b Remove unused TransactionCache
(cherry picked from commit a31e828976)
2018-11-24 17:45:46 +02:00
Roman Zeyde
08322b2144 Drop Electrum JSON-RPC support
It can be re-added later as a separate crate.

(cherry picked from commit e02e57d916)
2018-11-24 17:44:23 +02:00
Nadav Ivgi
e718eeaf4a Match Electrum's merkle proof format
Not the format we need, but at least its a known format

(cherry picked from commit 9067911215991993d593bd18d9c94b9d21e32fbf)
(cherry picked from commit dde87da6f0)
2018-11-24 17:43:44 +02:00
Lawrence Nahum
bdfb1030c9
use correct default rpc port for liquidd 2018-11-22 15:38:08 +01:00
Roman Zeyde
ff32483a09 Run 'cargo +stable fmt --all' 2018-11-15 20:54:33 +02:00
Roman Zeyde
b2829e7ac3 Update rust-bitcoin to 0.15.1 and re-generate Cargo.lock
Also update `elements` dependency to support latest rust-bitcoin:
5f4531fb30
2018-11-15 20:53:15 +02:00
Nadav Ivgi
324ff289c2 Fix transaction ordering
(cherry picked from commit fbc5ed63fa)
2018-11-14 23:37:41 +02:00
Nadav Ivgi
d2e2c940e0 Expose the block version and merkle root
(cherry picked from commit 8fba51c5f2)
2018-11-14 23:15:57 +02:00
Nadav Ivgi
c6d7ae938f Change query.get_merkle_proof() to take the block hash
(cherry picked from commit 79d00326a4)
2018-11-14 21:40:27 +02:00
Nadav Ivgi
8d3189a76d Use new blockhash=>txids index to fetch block txs
So that GET /block/:hash/txs won't depend on bitcoind.

(cherry picked from commit 004552e086)
2018-11-14 21:40:27 +02:00
Nadav Ivgi
ffa6e080b5 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.

(cherry picked from commit 32e96c137d)
2018-11-14 21:40:27 +02:00
Nadav Ivgi
3abba23a92 Reduce to 25 txs per page
(cherry picked from commit 56f5a8ea1e)
2018-11-14 17:36:58 +02:00
Nadav Ivgi
8efbc671b7 Always return status in /tx/:txid
(cherry picked from commit 64fdc164dd)
2018-11-14 17:36:58 +02:00
Nadav Ivgi
69578f32c0 Add Cache-Control header based on confirmation depth
(cherry picked from commit bc4fb7e9e3)
2018-11-14 17:36:53 +02:00
Nadav Ivgi
d0772322bc Add --http-addr option to configure the HTTP server listen address/port
(cherry picked from commit 681ff1a0fe)
2018-11-13 06:36:02 +02:00
Nadav Ivgi
73306f3445 Grammar
(cherry picked from commit 46ec3b9a7b)
2018-11-11 00:41:31 +02:00
Nadav Ivgi
a328d93ff1 Remove unused imports 2018-11-11 00:25:56 +02:00
Nadav Ivgi
ce2dc91eda Refactor API paths and formats 2018-11-11 00:25:40 +02:00
Nadav Ivgi
e82c904f26 Fix typo 2018-11-08 02:29:00 +02:00
Nadav Ivgi
1e2dbec653 Don't encode p2pk addresses 2018-11-08 02:21:00 +02:00
Nadav Ivgi
5da0c64f00 Format inflation_keys in whole numbers, see https://github.com/ElementsProject/rust-elements/issues/7 2018-11-08 00:48:59 +02:00
Nadav Ivgi
b3c4537601 Remove CORS 2018-11-07 11:44:42 +02:00
Nadav Ivgi
266d94401b Add asset to GET /address/:addr/utxo 2018-11-07 08:29:11 +02:00
Nadav Ivgi
3953423833 Add issuance details to txin 2018-11-07 06:23:02 +02:00
Nadav Ivgi
d26b152901 Don't error for addresses with too many txs, return a valid response with no txs info instead
(cherry picked from commit 2f7793ffa1)
2018-11-05 15:32:08 +02:00
Nadav Ivgi
24b9435b43 Error handling refactoringg
- Introduce HttpError (replaces StringError)
- Return errors as Err()
- Hide internal errors, explicitly define which errors should be user-visible

(cherry picked from commit a8c0501b15)
2018-11-05 15:27:49 +02:00
Nadav Ivgi
2149bb6123 Don't send Access-Control-Allow-Origin
will be added by reverse proxies as needed

(cherry picked from commit 97df9fb955)
2018-10-30 22:56:32 +02:00
Nadav Ivgi
71b7780482 Accept verificationprogress if its close to 1 2018-10-29 21:58:18 +02:00
Nadav Ivgi
b486c4ddc4 Wait for bitcoind to fully sync-up (verificationprogress==1) before starting the HTTP server 2018-10-29 19:57:08 +02:00
Nadav Ivgi
2d7b3f7945 Implement Liquid address encoding, refs #57 2018-10-29 19:01:26 +02:00
Nadav Ivgi
33397c21bb Add parent chain configuration
Used for verifying the genesis hash of peg-out requests,
and for encoding peg-out addresses.
2018-10-29 13:50:17 +02:00
Nadav Ivgi
7534bff544 Don't load spending txs of unspendable outputs 2018-10-27 23:55:15 +03:00
Nadav Ivgi
7b45b48447 Parse and expose peg-out information 2018-10-27 23:31:28 +03:00
Nadav Ivgi
b60e4037b1 Only fetch as many txids as needed in order to know that there are too many.
And increase the limit to 100.

(cherry picked from commit 83a6c40b0c65c3af5e049a5a61cabf937ebb98ad)
2018-10-27 18:38:13 +02:00
Nadav Ivgi
97052aabde Implement endpoints for finding spending txs
GET /tx/:txid/outspends and GET /tx/:txid/outspend/:vout

(cherry picked from commit bb8250ae4c675b748efe36cf1a84957eca546625)
2018-10-27 18:38:13 +02:00
Nadav Ivgi
97fcdf7a76 Only start HTTP server once when the index is fully synced
This also disables the Electrum RPC server, which we don't use.

(cherry picked from commit b74fff4e8864d683b6fba7db74612a5c21bbf159)
2018-10-27 03:24:45 +02:00
Nadav Ivgi
aa6c362236 Expose transaction input nSequence
(cherry picked from commit 46d56a05d630be2e64a362cc34c4f908c7c704c5)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
a9a30c1b96 Change error message for too many txs
(cherry picked from commit 06d667d3fba4cd8c698a560f9cbd28facf745c42)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
223a492e01 Implement GET /address/:addr/utxo
(cherry picked from commit 47dce129f0e61304029acaf91fc0f4968a98bbfd)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
e3eed32606 Verify addresses are on the correct network
(cherry picked from commit a03724e6aaa4881577ccba8473b1431859148d2f)
2018-10-26 22:17:18 +02:00
Nadav Ivgi
5a84b7f25f Reply with StringError messages
(cherry picked from commit 4f56a4f62d4ba2310167bd0533df7799af88496e)
2018-10-26 22:17:18 +02:00