Commit Graph

833 Commits

Author SHA1 Message Date
Nadav Ivgi
b2a84026a5 Update itertools to v0.8.0 2019-01-20 09:59:17 +02:00
Nadav Ivgi
b644d25cd8 Indicate mempool txs are unconfirmed instead of a null "status" 2019-01-20 08:49:46 +02:00
Nadav Ivgi
fb5919f06e cargo fmt 2019-01-20 07:28:06 +02:00
Nadav Ivgi
da3b8107c1 Query: Use accessor methods for chain and mempool 2019-01-19 12:57:21 +02:00
Nadav Ivgi
4196d06a4c Optimization: Store value of outputs/prevouts in history rows
With this, utxo() and stats() no longer have to make txo lookups and can
rely solely on history rows, confirmation rows and in-memory data.

This required removing the "script pubkey" from Utxo, as it is no longer known.
But this is okay, because Utxos are always returned in the context of a specific
address/scripthash that was requested by the user and is known to him.
2019-01-19 11:35:58 +02:00
Nadav Ivgi
e33be76a7a Implement GET /address/:addr/mempool-txs
and /scripthash/:hash/mempool-txs
2019-01-19 10:27:11 +02:00
Nadav Ivgi
7b5aaacdc9 Use new Query in REST 2019-01-19 10:26:18 +02:00
Nadav Ivgi
b7e04e3048 Implement new Query encapsulating ChainQuery and Mempool
With some related changes:

- Mempool::lookup_txos() signature was changed to match ChainQuery::lookup_txos()

- Removed some ChainQuery methods that are now exposed on Query
2019-01-19 10:23:14 +02:00
Nadav Ivgi
2c1f698dbd Implement Mempool::lookup_raw_txn() 2019-01-19 10:20:17 +02:00
Nadav Ivgi
4ad7695af1 Implement Mempool::utxo() and a stub placeholder for Mempool::stats() 2019-01-19 10:19:41 +02:00
Nadav Ivgi
ff54a19907 Mempool: Index spend edges, add lookup_spend() 2019-01-19 09:29:27 +02:00
Nadav Ivgi
50c594af1c Don't attach "status" to block txs
They all share the same status, so this is unnecessary.
2019-01-19 09:20:02 +02:00
Nadav Ivgi
3bbde8387f Fix Mempool::remove(): add missing not 2019-01-19 08:56:16 +02:00
Nadav Ivgi
6c27e80746 Rename Query -> ChainQuery 2019-01-19 08:55:18 +02:00
Nadav Ivgi
74d695a79e Correct names for funding/spending 2019-01-19 07:25:18 +02:00
Roman Zeyde
27037d9305
Add Prometheus metrics to the new Indexer and Query 2019-01-18 11:16:16 +02:00
Nadav Ivgi
1cb864222c Implement cache and incremental updates for script stats 2019-01-16 03:06:33 +02:00
Nadav Ivgi
bc60ede45d Replace dedup() with unique()
Required because the same txid can appear non-consecutively
in the case of a transactions that both funds and spends from
the same script.

This requires storing a list of all seen txid in memory,
which isn't ideal. This list could theoretically be reset
whenever we reach a new block height, but currently isn't.
2019-01-16 02:13:50 +02:00
Roman Zeyde
cee33f7e3a
Update RocksDB crate to 0.11 2019-01-13 15:53:03 +02:00
Roman Zeyde
7d8e3d8c47
Add missing file 2019-01-07 00:03:38 +02:00
Roman Zeyde
dc7dd0cc68
Update rust-rocksdb dependency for SetOptions API
Still not officially released (but should be at 0.11)
2019-01-06 09:59:30 +02:00
Roman Zeyde
3830fc4796
Mark non-public methods as such 2018-12-24 12:57:28 +02:00
Roman Zeyde
a8fe3cad0a
Make ScriptStats field names shorter
We should have separate stats for confirmed and unconfirmed transactions.
2018-12-24 12:48:49 +02:00
Roman Zeyde
7643a81e01
Load blockheaders for more efficient startup
We shouldn't re-download all headers from bitcoind, only the ones that
are missing from the DB.
2018-12-24 12:42:20 +02:00
Roman Zeyde
d2dc53c80e
Remove old modules from lib.rs 2018-12-24 09:02:06 +02:00
Roman Zeyde
0eb76ccc5a
Add conditional support for Elements' data structures
The code fails to build with `--feature=liquid`, but most of the errors are
around confidential values and block header differences:

46d01f91ab/liquid-errors.txt
2018-12-24 09:00:38 +02:00
Roman Zeyde
88d695c7a5
Enable auto compactions after the first index update 2018-12-20 22:30:10 +02:00
Roman Zeyde
4387d315e9
Update RocksDB (for SetOptions API support) 2018-12-20 22:30:09 +02:00
Roman Zeyde
59baa02115
Wait for daemon to fully sync before indexing and starting REST API 2018-12-20 22:30:06 +02:00
Roman Zeyde
257e788cf3
Merge branch 'bitcoin_e' into new-index 2018-12-19 11:57:42 +02:00
Roman Zeyde
d0073711db
Rename binary to 'electrs' for backwards compatibility 2018-12-19 11:52:12 +02:00
Roman Zeyde
75318516e7
Add simple (and not very efficient) mempool index implementation 2018-12-19 10:47:12 +02:00
Roman Zeyde
87feebafcb
Don't use blk*.dat on subsequent indexer invocations 2018-12-19 10:47:11 +02:00
Roman Zeyde
f77e6e3c98
Serialize TxHistoryKey MSB-first
Otherwise, lexicographic order won't be according to confirmed_height.
2018-12-19 10:47:07 +02:00
Roman Zeyde
5fedce2485
Run 'cargo fmt' 2018-12-18 17:58:37 +02:00
Nadav Ivgi
e53a05c03d Add db version compatibility field 2018-12-18 06:52:48 +02:00
Nadav Ivgi
2cecf51402 Parallel lookup for tx outputs spends 2018-12-18 03:27:47 +02:00
Nadav Ivgi
0c212bb9f3 Remove explicit lifetime annotations no longer required by recent Rust 2018-12-18 03:27:04 +02:00
Nadav Ivgi
6b7ff7ae1a Remove block height from TxConfRow
Rely on the hash->height map stored on HeaderList instead.
2018-12-18 03:25:12 +02:00
Roman Zeyde
3c7f0a41b6
Change compute_script_hash() argument to be &Script 2018-12-17 14:53:38 +02:00
Roman Zeyde
78f07f969f
Remove unused code 2018-12-17 13:09:02 +02:00
Roman Zeyde
1519b3587a
Enable graceful shutdown for the REST API server 2018-12-17 13:07:00 +02:00
Roman Zeyde
bfb07c392b
Store tip after initial indexing 2018-12-17 12:51:19 +02:00
Roman Zeyde
c9a845dd32
Mark added/indexed blocks explicitly as "done"
Instead of relying on other block-related rows.
2018-12-17 12:51:19 +02:00
Roman Zeyde
796aec75e2
No need to use INFO for blk*.dat listing log 2018-12-16 16:29:01 +02:00
Roman Zeyde
e355a7f299
Fetch from bitcoind after initial indexing 2018-12-16 16:26:17 +02:00
Roman Zeyde
1e84fa56a9
Fix 'use' statement at tests 2018-12-16 15:15:18 +02:00
Roman Zeyde
dbe586c102
Rename Indexer::flush() into start_flushing()
It can be called once (after initial indexing is over).
2018-12-16 15:08:24 +02:00
Roman Zeyde
d9d3f1f6c3
Update indexer repeatedly when bestblockhash changes 2018-12-16 15:05:10 +02:00
Roman Zeyde
0cccb43af1
Log when starting full headers' download 2018-12-16 14:59:26 +02:00