Commit graph

671 commits

Author SHA1 Message Date
Roman Zeyde
844723f5f4 Simplify 'blockchain.scripthash.get_balance' implementation 2021-09-15 20:50:57 +03:00
Roman Zeyde
fb7e9c576c Cache amounts in status::TxEntry 2021-09-15 20:50:57 +03:00
Roman Zeyde
8d12df353c Use try_from for explicit type conversion (instead of try_into) 2021-09-12 16:22:32 +03:00
Roman Zeyde
f5df00f631 Allow single-sync invocation using --sync-once commandline flag 2021-09-11 11:01:05 +03:00
Roman Zeyde
5332cc677f Refactor and document status.rs 2021-09-08 21:04:30 +03:00
Roman Zeyde
3090866fdd Drop helper binaries and some APIs 2021-09-08 19:14:44 +03:00
Roman Zeyde
2e5ba9b401 Add docs to chain.rs 2021-09-05 22:09:50 +03:00
Roman Zeyde
75e0da7168 Simplify txid min/max handling 2021-09-05 19:14:17 +03:00
Roman Zeyde
e1ec17c5b1 Run p2p block parsing and processing concurrently 2021-09-01 21:25:53 +03:00
Roman Zeyde
f9346d2a1d Drop hyper dependency
https://rustsec.org/advisories/RUSTSEC-2021-0078

Use tiny_http for Prometheus instead.
2021-08-27 20:53:11 +03:00
Roman Zeyde
64230332cc Refactor thread spawning into a separate module 2021-08-27 20:53:11 +03:00
Roman Zeyde
0516aead2a Bump bitcoin dependency to 0.27
A bit hacky solution until https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/196 is merged.
2021-08-27 19:46:56 +03:00
Roman Zeyde
6a7cd19946 Reuse scripthash subscription 2021-08-27 12:23:34 +03:00
Roman Zeyde
ffab4f4efa Fix incorrect JSON response for 'blockchain.transaction.get' RPC
Daemon::get_transaction_hex should return a string, not a dictionary.
2021-08-24 23:32:27 +03:00
Roman Zeyde
9796a4433c Log RocksDB statistics after each flush 2021-08-22 22:02:53 +03:00
Roman Zeyde
b43173881d Disable 'clippy::identity_conversion' on generated configuration handling code
Otherwise, clippy fails with:

warning: identical conversion
   --> /media/roman/3TB/roman/Code/electrs/target/debug/build/electrs-56b1e395b2bcf88c/out/configure_me_config.rs:339:25
    |
339 |                 db_dir: db_dir.into(),
    |                         ^^^^^^^^^^^^^ help: consider removing `.into()`: `db_dir`
    |
    = note: `#[warn(clippy::identity_conversion)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

warning: identical conversion
   --> /media/roman/3TB/roman/Code/electrs/target/debug/build/electrs-56b1e395b2bcf88c/out/configure_me_config.rs:340:29
    |
340 |                 daemon_dir: daemon_dir.into(),
    |                             ^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `daemon_dir`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

warning: identical conversion
   --> /media/roman/3TB/roman/Code/electrs/target/debug/build/electrs-56b1e395b2bcf88c/out/configure_me_config.rs:349:37
    |
349 |                 wait_duration_secs: wait_duration_secs.into(),
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `wait_duration_secs`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

warning: identical conversion
   --> /media/roman/3TB/roman/Code/electrs/target/debug/build/electrs-56b1e395b2bcf88c/out/configure_me_config.rs:350:35
    |
350 |                 index_batch_size: index_batch_size.into(),
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `index_batch_size`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

warning: identical conversion
   --> /media/roman/3TB/roman/Code/electrs/target/debug/build/electrs-56b1e395b2bcf88c/out/configure_me_config.rs:351:29
    |
351 |                 txid_limit: txid_limit.into(),
    |                             ^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `txid_limit`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

warning: identical conversion
   --> /media/roman/3TB/roman/Code/electrs/target/debug/build/electrs-56b1e395b2bcf88c/out/configure_me_config.rs:352:32
    |
352 |                 server_banner: server_banner.into(),
    |                                ^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `server_banner`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion
2021-08-21 19:10:21 +03:00
Roman Zeyde
33e2c72923 Fixup a clippy nit 2021-08-21 19:05:22 +03:00
Roman Zeyde
31765e3e49 Limit index lookups to prevent DoS for "popular" addresses 2021-08-21 18:25:31 +03:00
Pantamis
fa53180846
Small fix 2021-08-16 13:08:49 +02:00
Pantamis
aa6c5b1578
Use the same log verbosity levels as master
Current verbosity level of master: https://docs.rs/stderrlog/0.5.1/src/stderrlog/lib.rs.html#377
2021-08-16 12:58:03 +02:00
Roman Zeyde
27e7541644 Rename scripthash status 2021-08-13 20:34:32 +03:00
Roman Zeyde
1c198de0be Add a few more tests to types.rs 2021-08-13 20:34:28 +03:00
Roman Zeyde
2ab5fb1da6 Use HistoryEntry instead of {Confirmed,Mempool}Entry
Should simplify JSON serialization and height computation.
2021-08-13 20:34:14 +03:00
Roman Zeyde
ab860d9315 Add a workaround for latest Bitcoin Core
See https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/190.
2021-07-30 08:44:22 +03:00
Roman Zeyde
d153bfa2eb Use log verbosity level from configration
Following https://github.com/romanz/electrs/issues/440#issuecomment-886094765.
2021-07-27 20:52:03 +03:00
Roman Zeyde
50d22425bb Drop unused rows' count 2021-07-23 19:16:04 +03:00
Roman Zeyde
18a467b9aa Add server.features RPC 2021-07-23 18:47:00 +03:00
Roman Zeyde
5f0a10e517 Don't log RPC password 2021-07-22 21:55:03 +03:00
Roman Zeyde
8ef15e25b9 Fix --auth support
If not specified, use `--cookie-file`.
2021-07-22 21:55:03 +03:00
Roman Zeyde
2510531d16 Fixup some nightly clippy lints 2021-07-20 18:56:43 +03:00
Roman Zeyde
3bf5e5c266 Return original JSON from getrawtransaction RPC
Should fix https://github.com/romanz/electrs/issues/427
2021-07-16 19:15:37 +03:00
Roman Zeyde
11d703f545 Remove unneeded into_iter() 2021-07-04 18:30:23 +03:00
Roman Zeyde
c754485320 Add blockchain.scripthash.get_balance RPC 2021-07-04 18:30:23 +03:00
Roman Zeyde
4d2481ed45 Allow calling blockchain.scripthash.get_history without subscription
Fixes #419
2021-07-04 12:33:33 +03:00
Roman Zeyde
bb5caadb6b Move p2p-related code out of daemon.rs 2021-07-04 12:33:33 +03:00
Roman Zeyde
f03c1d0938 Use JSONRPC error codes
See https://www.jsonrpc.org/specification#error_object
2021-06-29 15:44:40 +03:00
Roman Zeyde
0d44ec67e2 Fix a typo 2021-06-29 15:44:40 +03:00
Roman Zeyde
94f0afaf85 Remove eprintln in tests 2021-06-29 15:44:40 +03:00
Roman Zeyde
d4134113cb Rename PREFIX_LEN -> HASH_PREFIX_LEN 2021-06-29 15:44:40 +03:00
Roman Zeyde
05d6dc1975 Elide lifetime at iter_prefix_cf() 2021-06-29 15:44:40 +03:00
Roman Zeyde
f5884cd172 Simplify indexing code a bit 2021-06-18 20:37:53 +03:00
Roman Zeyde
b9e8aa8e7c Add a few unittests for Chain 2021-06-18 17:49:29 +03:00
Roman Zeyde
af834a009f Remove unused code 2021-06-18 13:01:16 +03:00
Roman Zeyde
45833c3b61 Use parking_lot::{Mutex, RwLock} instead of std::sync 2021-06-14 13:20:21 +03:00
Roman Zeyde
23c775fb47 Don't fail on mempool sync errors 2021-06-04 12:49:37 +03:00
Roman Zeyde
6eb8eb5227 Refactor waiting for daemon 2021-06-03 19:08:23 +03:00
Roman Zeyde
50e55aa818 Refactor status helper functions 2021-06-02 12:54:03 +03:00
Roman Zeyde
cf078acbc6 Fixup clippy warnings 2021-05-31 18:57:06 +03:00
Roman Zeyde
df513cfb18 Don't ignore --cookie-file configuration parameter
Fixes #407
2021-05-31 16:26:58 +03:00
Roman Zeyde
2df789e053 Don't panic on incorrect metrics' configuration 2021-05-30 21:46:37 +03:00