From 87bb2a89d865427c0ec02c0df385092d411c0c81 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Wed, 21 Jul 2021 10:53:53 -0500 Subject: [PATCH 01/13] Update README.md (#90) Fix a typo about re-syncing and reorgs in the README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index adc510d..c2f2b60 100644 --- a/README.md +++ b/README.md @@ -1165,7 +1165,7 @@ To catch-up with historical events that your app missed while being down, you ca If the `synced-tip` is still part of the best chain, this will return all historical `Transaction`, `TxoFunded` and `TxoSpent` events that occurred after `block-height` (exclusive, ordered with oldest first, unconfirmed included at the end), followed by a *single* `ChainTip` event with the currently synced tip, followed by a stream of real-time events. If the `synced-tip` is no longer part of the best chain, a `410 Gone` error will be returned indicating that a reorg took place. -One way to recover from reorgs it to re-sync since `N` blocks before the orphaned `synced-tip` and consider any entries that +One way to recover from reorgs is to re-sync since `N` blocks before the orphaned `synced-tip` and consider any entries that no longer show up as double-spent (where `N` is large enough such that reorgs deeper than it are unlikely). You can specify `synced-tip` with just the height to skip reorg detection (for example, `0` to get all events since the genesis block). From 6b95c5045a9f87036212bd277e8efe63f17dc99d Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Mon, 4 Oct 2021 12:21:49 +0300 Subject: [PATCH 02/13] Upgrade to rust-bitcoin v0.27, rust-miniscript v6.0 and rust-bitcoincore-rpc v0.14 --- CHANGELOG.md | 4 + Cargo.lock | 229 ++++++++++++----------------------------------- Cargo.toml | 8 +- src/app.rs | 4 +- src/util/xpub.rs | 7 +- 5 files changed, 73 insertions(+), 179 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c7de7..787831a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- Update to rust-bitcoin v0.27, rust-miniscript v6.0 and rust-bitcoincore-rpc v0.14 + ## 0.2.4 - 2021-03-25 - Allow specifying an explicit script type for xpubs using `-x :wpkh`, `-x :shwpkh` or `-x :pkh`. diff --git a/Cargo.lock b/Cargo.lock index 0e69cc5..3383330 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,7 +24,7 @@ dependencies = [ "android_log-sys", "env_logger", "lazy_static", - "log 0.4.14", + "log", ] [[package]] @@ -71,16 +71,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] - [[package]] name = "base64" version = "0.13.0" @@ -98,15 +88,15 @@ dependencies = [ [[package]] name = "bech32" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" +checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" [[package]] name = "bitcoin" -version = "0.26.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec5f88a446d66e7474a3b8fa2e348320b574463fb78d799d90ba68f79f48e0e" +checksum = "9a41df6ad9642c5c15ae312dd3d074de38fd3eb7cc87ad4ce10f90292a83fe4d" dependencies = [ "base64-compat", "bech32", @@ -117,34 +107,33 @@ dependencies = [ [[package]] name = "bitcoin_hashes" -version = "0.9.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aaf87b776808e26ae93289bc7d025092b6d909c193f0cdee0b3a86e7bd3c776" +checksum = "006cc91e1a1d99819bc5b8214be3555c1f0611b169f527a1fdc54ed1f2b745b0" dependencies = [ "serde", ] [[package]] name = "bitcoincore-rpc" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d708433972bf78bd5f909d1d288f9ac1cceeab1460edb954e962f83e1f440a3" +checksum = "7b8d99d58466295cb2bf72c6959b784d59f8f0d6977458d2ba3eb75c834f36c3" dependencies = [ "bitcoincore-rpc-json", "jsonrpc", - "log 0.4.14", + "log", "serde", "serde_json", ] [[package]] name = "bitcoincore-rpc-json" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "977e55a945ab1e3c446dea93267876703c15e07c7d6eeb1dfa1766b3190c560f" +checksum = "dce91de73c61f5776cf938bfa88378c5b404a70e3369b761dacbe6024fea79dd" dependencies = [ "bitcoin", - "hex", "serde", "serde_json", ] @@ -204,7 +193,7 @@ dependencies = [ "dirs", "dotenv", "lazy_static", - "log 0.4.14", + "log", "miniscript", "pretty_env_logger", "rand 0.8.3", @@ -359,7 +348,7 @@ checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", "humantime", - "log 0.4.14", + "log", "regex", "termcolor", ] @@ -392,7 +381,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -466,7 +455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", - "version_check 0.9.3", + "version_check", ] [[package]] @@ -522,12 +511,12 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" dependencies = [ - "base64 0.13.0", + "base64", "bitflags", "bytes", "headers-core", "http", - "mime 0.3.16", + "mime", "sha-1", "time", ] @@ -559,12 +548,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hex" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" - [[package]] name = "http" version = "0.2.3" @@ -608,25 +591,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "hyper" -version = "0.10.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" -dependencies = [ - "base64 0.9.3", - "httparse", - "language-tags", - "log 0.3.9", - "mime 0.2.6", - "num_cpus", - "time", - "traitobject", - "typeable", - "unicase 1.4.2", - "url 1.7.2", -] - [[package]] name = "hyper" version = "0.14.4" @@ -658,23 +622,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.4", + "hyper", "native-tls", "tokio", "tokio-native-tls", ] -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.2" @@ -728,22 +681,16 @@ dependencies = [ [[package]] name = "jsonrpc" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436f3455a8a4e9c7b14de9f1206198ee5d0bdc2db1b560339d2141093d7dd389" +checksum = "ad24d69a8a0698db8ffb9048e937e8ae3ee3bc45772a5d7b6979b1d2d5b6a9f7" dependencies = [ - "hyper 0.10.16", + "base64-compat", "serde", "serde_derive", "serde_json", ] -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -756,15 +703,6 @@ version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.14", -] - [[package]] name = "log" version = "0.4.14" @@ -786,15 +724,6 @@ version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -[[package]] -name = "mime" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" -dependencies = [ - "log 0.3.9", -] - [[package]] name = "mime" version = "0.3.16" @@ -807,15 +736,15 @@ version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" dependencies = [ - "mime 0.3.16", - "unicase 2.6.0", + "mime", + "unicase", ] [[package]] name = "miniscript" -version = "5.1.0" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71f455be59a359d50370c4f587afbc5739c862e684c5afecae80ab93e7474b4e" +checksum = "d69450033bf162edf854d4aacaff82ca5ef34fa81f6cf69e1c81a103f0834997" dependencies = [ "bitcoin", "serde", @@ -828,7 +757,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" dependencies = [ "libc", - "log 0.4.14", + "log", "miow", "ntapi", "winapi", @@ -851,8 +780,8 @@ checksum = "d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4" dependencies = [ "buf_redux", "httparse", - "log 0.4.14", - "mime 0.3.16", + "log", + "mime", "mime_guess", "quick-error", "rand 0.7.3", @@ -869,7 +798,7 @@ checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" dependencies = [ "lazy_static", "libc", - "log 0.4.14", + "log", "openssl", "openssl-probe", "openssl-sys", @@ -962,12 +891,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -1025,7 +948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" dependencies = [ "env_logger", - "log 0.4.14", + "log", ] [[package]] @@ -1038,7 +961,7 @@ dependencies = [ "proc-macro2", "quote", "syn", - "version_check 0.9.3", + "version_check", ] [[package]] @@ -1049,7 +972,7 @@ checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", - "version_check 0.9.3", + "version_check", ] [[package]] @@ -1215,29 +1138,29 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" dependencies = [ - "base64 0.13.0", + "base64", "bytes", "encoding_rs", "futures-core", "futures-util", "http", "http-body", - "hyper 0.14.4", + "hyper", "hyper-tls", "ipnet", "js-sys", "lazy_static", - "log 0.4.14", - "mime 0.3.16", + "log", + "mime", "native-tls", - "percent-encoding 2.1.0", + "percent-encoding", "pin-project-lite", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", - "url 2.2.1", + "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1250,7 +1173,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" dependencies = [ - "base64 0.13.0", + "base64", "blake2b_simd", "constant_time_eq", "crossbeam-utils", @@ -1286,9 +1209,9 @@ checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" [[package]] name = "secp256k1" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733b114f058f260c0af7591434eef4272ae1a8ec2751766d3cb89c6df8d5e450" +checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" dependencies = [ "secp256k1-sys", "serde", @@ -1591,7 +1514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" dependencies = [ "futures-util", - "log 0.4.14", + "log", "pin-project", "tokio", "tungstenite", @@ -1606,7 +1529,7 @@ dependencies = [ "bytes", "futures-core", "futures-sink", - "log 0.4.14", + "log", "pin-project-lite", "tokio", ] @@ -1624,7 +1547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" dependencies = [ "cfg-if", - "log 0.4.14", + "log", "pin-project-lite", "tracing-core", ] @@ -1648,12 +1571,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "traitobject" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - [[package]] name = "try-lock" version = "0.2.3" @@ -1666,16 +1583,16 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" dependencies = [ - "base64 0.13.0", + "base64", "byteorder", "bytes", "http", "httparse", "input_buffer", - "log 0.4.14", + "log", "rand 0.8.3", "sha-1", - "url 2.2.1", + "url", "utf-8", ] @@ -1688,34 +1605,19 @@ dependencies = [ "memchr", ] -[[package]] -name = "typeable" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" - [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -[[package]] -name = "unicase" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -dependencies = [ - "version_check 0.1.5", -] - [[package]] name = "unicase" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check 0.9.3", + "version_check", ] [[package]] @@ -1754,17 +1656,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.2.1" @@ -1772,9 +1663,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ "form_urlencoded", - "idna 0.2.2", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -1795,12 +1686,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "version_check" version = "0.9.3" @@ -1813,7 +1698,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log 0.4.14", + "log", "try-lock", ] @@ -1827,12 +1712,12 @@ dependencies = [ "futures", "headers", "http", - "hyper 0.14.4", - "log 0.4.14", - "mime 0.3.16", + "hyper", + "log", + "mime", "mime_guess", "multipart", - "percent-encoding 2.1.0", + "percent-encoding", "pin-project", "scoped-tls", "serde", @@ -1879,7 +1764,7 @@ checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" dependencies = [ "bumpalo", "lazy_static", - "log 0.4.14", + "log", "proc-macro2", "quote", "syn", diff --git a/Cargo.toml b/Cargo.toml index f05e8a5..da6367b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,10 +30,10 @@ path = "src/main.rs" required-features = [ "cli" ] [dependencies] -bitcoin = { version = "0.26.0", features = [ "use-serde" ] } -bitcoin_hashes = { version = "0.9.0", features = [ "serde" ] } -bitcoincore-rpc = "0.13.0" -miniscript = { version = "5.0.1", features = [ "serde" ] } +bitcoin = { version = "0.27.1", features = [ "use-serde" ] } +bitcoin_hashes = { version = "0.10.0", features = [ "serde" ] } +bitcoincore-rpc = "0.14.0" +miniscript = { version = "6.0.1", features = [ "serde" ] } chrono = { version = "0.4.19", default-features = false, features = ["alloc"] } serde = { version = "1.0.117", features = [ "derive" ] } serde_json = "1.0.59" diff --git a/src/app.rs b/src/app.rs index b2bc5de..826e3c6 100644 --- a/src/app.rs +++ b/src/app.rs @@ -47,7 +47,7 @@ impl App { let watcher = WalletWatcher::from_config(&config)?; let rpc = Arc::new(RpcClient::new( - config.bitcoind_url(), + &config.bitcoind_url(), config.bitcoind_auth()?, )?); let indexer = Arc::new(RwLock::new(Indexer::new(rpc.clone(), watcher)?)); @@ -311,7 +311,7 @@ impl App { } pub fn test_rpc(config: &Config) -> Result<()> { - let rpc = RpcClient::new(config.bitcoind_url(), config.bitcoind_auth()?)?; + let rpc = RpcClient::new(&config.bitcoind_url(), config.bitcoind_auth()?)?; rpc.get_wallet_info()?; Ok(()) } diff --git a/src/util/xpub.rs b/src/util/xpub.rs index 5361c2c..fe9a82a 100644 --- a/src/util/xpub.rs +++ b/src/util/xpub.rs @@ -1,3 +1,4 @@ +use std::convert::TryInto; use std::fmt; use std::str::FromStr; @@ -148,7 +149,11 @@ fn parse_xyz_version(version: &[u8]) -> Result<(Network, ScriptType), base58::Er [0x04u8, 0x5F, 0x1C, 0xF6] => (Network::Testnet, ScriptType::P2wpkh), [0x04u8, 0x4A, 0x52, 0x62] => (Network::Testnet, ScriptType::P2shP2wpkh), - _ => return Err(base58::Error::InvalidVersion(version.to_vec())), + _ => { + return Err(base58::Error::InvalidExtendedKeyVersion( + version.try_into().unwrap(), + )) + } }) } From 97f9edfc29932e4d3f33751fa967d0af9d60bccc Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 01:39:03 +0300 Subject: [PATCH 03/13] Implement SOCKS5h proxy support (#21) Using the 'socks' crate and custom jsonrpc transport. Requires the 'proxy' feature flag, which is enabled by default. --- CHANGELOG.md | 2 + Cargo.lock | 61 ++++-- Cargo.toml | 6 +- src/app.rs | 6 +- src/config.rs | 9 + src/util/bitcoincore_ext.rs | 46 ++++- src/util/jsonrpc_proxy.rs | 364 ++++++++++++++++++++++++++++++++++++ src/util/mod.rs | 3 + 8 files changed, 478 insertions(+), 19 deletions(-) create mode 100644 src/util/jsonrpc_proxy.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 787831a..01e699d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Support connecting to the Bitcoin Core RPC through a proxy (#21) + - Update to rust-bitcoin v0.27, rust-miniscript v6.0 and rust-bitcoincore-rpc v0.14 ## 0.2.4 - 2021-03-25 diff --git a/Cargo.lock b/Cargo.lock index 3383330..d68ce1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,7 +33,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -62,7 +62,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -201,6 +201,7 @@ dependencies = [ "serde", "serde_json", "signal-hook", + "socks", "structopt", "thiserror", "tokio", @@ -322,7 +323,7 @@ checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" dependencies = [ "libc", "redox_users", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -760,7 +761,7 @@ dependencies = [ "log", "miow", "ntapi", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -769,7 +770,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -814,7 +815,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1129,7 +1130,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1198,7 +1199,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1338,7 +1339,19 @@ checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ "cfg-if", "libc", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "socks" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30f86c7635fadf2814201a4f67efefb0007588ae7422ce299f354ab5c97f61ae" +dependencies = [ + "byteorder", + "libc", + "winapi 0.2.8", + "ws2_32-sys", ] [[package]] @@ -1393,7 +1406,7 @@ dependencies = [ "rand 0.8.3", "redox_syscall 0.2.5", "remove_dir_all", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1441,7 +1454,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1822,6 +1835,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -1832,6 +1851,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1844,7 +1869,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1859,5 +1884,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", ] diff --git a/Cargo.toml b/Cargo.toml index da6367b..8e97bac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,11 +12,12 @@ edition = "2018" include = [ "/src", "/LICENSE" ] [features] -default = [ "cli", "electrum", "http", "track-spends" ] +default = [ "cli", "electrum", "http", "proxy", "track-spends" ] cli = [ "extra", "structopt", "dotenv" ] extra = [ "dirs", "pretty_env_logger", "signal-hook" ] electrum = [] http = [ "warp", "tokio", "tokio-stream", "bitcoin/base64" ] +proxy = [ "socks" ] webhooks = [ "reqwest" ] track-spends = [] android = [ "android_logger" ] @@ -48,6 +49,9 @@ tokio = { version = "1.1.0", features = ["macros", "rt", "rt-multi-thread"], opt tokio-stream = { version = "0.1.2", default-features = false, optional = true } warp = { version = "0.3.0", optional = true } +# socks proxy deps +socks = { version = "0.3.3", optional = true } + # webhooks deps reqwest = { version = "0.11.0", optional = true, features = ["json", "blocking"] } diff --git a/src/app.rs b/src/app.rs index 826e3c6..46cf1b8 100644 --- a/src/app.rs +++ b/src/app.rs @@ -5,6 +5,7 @@ use std::{cell::Cell, net, thread}; use bitcoincore_rpc::{self as rpc, Client as RpcClient, RpcApi}; use crate::error::{BwtError, Result}; +use crate::util::bitcoincore_ext::create_rpc_client; use crate::util::progress::Progress; use crate::util::{banner, fd_readiness_notification, on_oneshot_done, throttle_sender, RpcApiExt}; use crate::{Config, IndexChange, Indexer, Query, WalletWatcher}; @@ -46,10 +47,7 @@ impl App { debug!(target: LT, "{}", scrub_config(&config)); let watcher = WalletWatcher::from_config(&config)?; - let rpc = Arc::new(RpcClient::new( - &config.bitcoind_url(), - config.bitcoind_auth()?, - )?); + let rpc = Arc::new(create_rpc_client(&config)?); let indexer = Arc::new(RwLock::new(Indexer::new(rpc.clone(), watcher)?)); let query = Arc::new(Query::new((&config).into(), rpc.clone(), indexer.clone())); diff --git a/src/config.rs b/src/config.rs index c8a4c69..4ef8a7e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -97,6 +97,14 @@ pub struct Config { )] pub bitcoind_cookie: Option, + /// Set a SOCKS5h proxy server for connecting to the Bitcoin Core RPC + #[cfg(feature = "proxy")] + #[cfg_attr( + feature = "cli", + structopt(short = "P", long, env, hide_env_values(true), display_order(35)) + )] + pub bitcoind_proxy: Option, + /// Create the specified bitcoind wallet if it's missing [env: CREATE_WALLET_IF_MISSING] #[cfg_attr(feature = "cli", structopt(long, short = "W", display_order(1002)))] #[serde(default)] @@ -735,6 +743,7 @@ defaultable!(Config, #[cfg(feature = "http")] http_addr, #[cfg(feature = "http")] http_cors, #[cfg(feature = "webhooks")] webhook_urls, + #[cfg(feature = "proxy")] bitcoind_proxy, #[cfg(unix)] unix_listener_path, ) @custom( diff --git a/src/util/bitcoincore_ext.rs b/src/util/bitcoincore_ext.rs index 6309e45..7dcbbca 100644 --- a/src/util/bitcoincore_ext.rs +++ b/src/util/bitcoincore_ext.rs @@ -4,7 +4,12 @@ use std::fmt::{self, Formatter}; use bitcoin::Address; use bitcoincore_rpc::json::{self, ImportMultiRescanSince}; -use bitcoincore_rpc::{self as rpc, Client, Result as RpcResult, RpcApi}; +use bitcoincore_rpc::{self as rpc, jsonrpc, Client, Result as RpcResult, RpcApi}; + +#[cfg(feature = "proxy")] +use super::jsonrpc_proxy::SimpleHttpTransport; +#[cfg(not(feature = "proxy"))] +use jsonrpc::simple_http::SimpleHttpTransport; // Extensions for rust-bitcoincore-rpc @@ -90,6 +95,45 @@ pub trait RpcApiExt: RpcApi { impl RpcApiExt for Client {} +pub fn create_rpc_client(config: &crate::Config) -> Result { + let mut builder = SimpleHttpTransport::builder().url(&config.bitcoind_url())?; + + if let (Some(user), pass) = get_user_pass(config.bitcoind_auth()?)? { + builder = builder.auth(user, pass); + } + + #[cfg(feature = "proxy")] + if let Some(proxy_addr) = &config.bitcoind_proxy { + builder = builder.proxy(proxy_addr)?; + } + + Ok(Client::from_jsonrpc(jsonrpc::Client::with_transport( + builder.build(), + ))) +} + +// Copied from rust-bitcoincore-rpc where it is private, pending +// https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/205 +fn get_user_pass(auth: rpc::Auth) -> rpc::Result<(Option, Option)> { + use rpc::{Auth, Error}; + use std::fs::File; + use std::io::Read; + match auth { + Auth::None => Ok((None, None)), + Auth::UserPass(u, p) => Ok((Some(u), Some(p))), + Auth::CookieFile(path) => { + let mut file = File::open(path)?; + let mut contents = String::new(); + file.read_to_string(&mut contents)?; + let mut split = contents.splitn(2, ":"); + Ok(( + Some(split.next().ok_or(Error::InvalidCookieFile)?.into()), + Some(split.next().ok_or(Error::InvalidCookieFile)?.into()), + )) + } + } +} + #[derive(Debug, Deserialize)] pub struct AddressEntry { pub purpose: json::GetAddressInfoResultLabelPurpose, diff --git a/src/util/jsonrpc_proxy.rs b/src/util/jsonrpc_proxy.rs new file mode 100644 index 0000000..8b4ecea --- /dev/null +++ b/src/util/jsonrpc_proxy.rs @@ -0,0 +1,364 @@ +use std::io::{BufRead, BufReader, Write}; +use std::net::{TcpStream, ToSocketAddrs}; +use std::time::{Duration, Instant}; +use std::{fmt, io, net, thread}; + +use bitcoincore_rpc::jsonrpc; +use jsonrpc::client::Transport; +use jsonrpc::{base64, Request, Response}; +use socks::{Socks5Stream, TargetAddr, ToTargetAddr}; + +// Based on the SimpleHttpTransport code from the jsonrpc crate, +// should eventually be PR'd upstream as an optional feature + +/// The default TCP port to use for connections. +/// Set to 8332, the default RPC port for bitcoind. +pub const DEFAULT_PORT: u16 = 8332; + +/// Simple HTTP transport that implements the necessary subset of HTTP for +/// running a bitcoind RPC client. +#[derive(Clone, Debug)] +pub struct SimpleHttpTransport { + addr: TargetAddr, + path: String, + timeout: Duration, + /// The value of the `Authorization` HTTP header. + basic_auth: Option, + proxy_addr: Option, +} + +impl Default for SimpleHttpTransport { + fn default() -> Self { + SimpleHttpTransport { + addr: TargetAddr::Ip(([127, 0, 0, 1], DEFAULT_PORT).into()), + path: "/".to_owned(), + timeout: Duration::from_secs(15), + basic_auth: None, + proxy_addr: None, + } + } +} + +impl SimpleHttpTransport { + /// Construct a new `SimpleHttpTransport` with default parameters + pub fn new() -> Self { + SimpleHttpTransport::default() + } + + /// Returns a builder for `SimpleHttpTransport` + pub fn builder() -> Builder { + Builder::new() + } + + fn request(&self, req: impl serde::Serialize) -> Result + where + R: for<'a> serde::de::Deserialize<'a>, + { + // Open connection + let request_deadline = Instant::now() + self.timeout; + let mut sock = match self.proxy_addr { + Some(proxy_addr) => Socks5Stream::connect(proxy_addr, self.addr.clone())?.into_inner(), + None => { + let addr = resolve_first_addr(&self.addr) + .map_err(|_| Error::url(format!("{:?}", self.addr), "invalid hostname"))?; + TcpStream::connect_timeout(&addr, self.timeout)? + } + }; + + // Serialize the body first so we can set the Content-Length header. + let body = serde_json::to_vec(&req)?; + + // Send HTTP request + sock.write_all(b"POST ")?; + sock.write_all(self.path.as_bytes())?; + sock.write_all(b" HTTP/1.1\r\n")?; + // Write headers + sock.write_all(b"Content-Type: application/json-rpc\r\n")?; + sock.write_all(b"Content-Length: ")?; + sock.write_all(body.len().to_string().as_bytes())?; + sock.write_all(b"\r\n")?; + if let Some(ref auth) = self.basic_auth { + sock.write_all(b"Authorization: ")?; + sock.write_all(auth.as_ref())?; + sock.write_all(b"\r\n")?; + } + // Write body + sock.write_all(b"\r\n")?; + sock.write_all(&body)?; + sock.flush()?; + + // Receive response + let mut reader = BufReader::new(sock); + + // Parse first HTTP response header line + let http_response = get_line(&mut reader, request_deadline)?; + if http_response.len() < 12 || !http_response.starts_with("HTTP/1.1 ") { + return Err(Error::HttpParseError); + } + let response_code = match http_response[9..12].parse::() { + Ok(n) => n, + Err(_) => return Err(Error::HttpParseError), + }; + + // Skip response header fields + while get_line(&mut reader, request_deadline)? != "\r\n" {} + + // Even if it's != 200, we parse the response as we may get a JSONRPC error instead + // of the less meaningful HTTP error code. + let resp_body = get_line(&mut reader, request_deadline)?; + match serde_json::from_str(&resp_body) { + Ok(s) => Ok(s), + Err(e) => { + if response_code != 200 { + Err(Error::HttpErrorCode(response_code)) + } else { + // If it was 200 then probably it was legitimately a parse error + Err(e.into()) + } + } + } + } +} + +/// Error that can happen when sending requests +#[derive(Debug)] +pub enum Error { + /// An invalid URL was passed. + InvalidUrl { + /// The URL passed. + url: String, + /// The reason the URL is invalid. + reason: &'static str, + }, + // An invalid proxy address was passed + InvalidProxyAddr, + /// An error occurred on the socket layer + SocketError(io::Error), + /// The HTTP header of the response couldn't be parsed + HttpParseError, + /// Unexpected HTTP error code (non-200) + HttpErrorCode(u16), + /// We didn't receive a complete response till the deadline ran out + Timeout, + /// JSON parsing error. + Json(serde_json::Error), +} + +impl Error { + /// Utility method to create [Error::InvalidUrl] variants. + fn url>(url: U, reason: &'static str) -> Error { + Error::InvalidUrl { + url: url.into(), + reason: reason, + } + } +} + +impl ::std::error::Error for Error {} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + Error::InvalidUrl { + ref url, + ref reason, + } => write!(f, "invalid URL '{}': {}", url, reason), + Error::InvalidProxyAddr => write!(f, "invalid proxy address"), + Error::SocketError(ref e) => write!(f, "Couldn't connect to host: {}", e), + Error::HttpParseError => f.write_str("Couldn't parse response header."), + Error::HttpErrorCode(c) => write!(f, "unexpected HTTP code: {}", c), + Error::Timeout => f.write_str("Didn't receive response data in time, timed out."), + Error::Json(ref e) => write!(f, "JSON error: {}", e), + } + } +} + +impl From for Error { + fn from(e: io::Error) -> Self { + Error::SocketError(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::Json(e) + } +} + +impl From for jsonrpc::Error { + fn from(e: Error) -> jsonrpc::Error { + match e { + Error::Json(e) => jsonrpc::Error::Json(e), + e => jsonrpc::Error::Transport(Box::new(e)), + } + } +} + +/// Try to read a line from a buffered reader. If no line can be read till the deadline is reached +/// return a timeout error. +fn get_line(reader: &mut R, deadline: Instant) -> Result { + let mut line = String::new(); + while deadline > Instant::now() { + match reader.read_line(&mut line) { + // EOF reached for now, try again later + Ok(0) => thread::sleep(Duration::from_millis(5)), + // received useful data, return it + Ok(_) => return Ok(line), + // io error occurred, abort + Err(e) => return Err(Error::SocketError(e)), + } + } + Err(Error::Timeout) +} + +impl Transport for SimpleHttpTransport { + fn send_request(&self, req: Request) -> Result { + Ok(self.request(req)?) + } + + fn send_batch(&self, reqs: &[Request]) -> Result, jsonrpc::Error> { + Ok(self.request(reqs)?) + } + + fn fmt_target(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "http://")?; + match self.addr { + TargetAddr::Ip(addr) => { + write!(f, "{}", addr)?; + } + TargetAddr::Domain(ref hostname, port) => { + write!(f, "{}:{}", hostname, port)?; + } + } + write!(f, "{}", self.path) + } +} + +/// Builder for simple bitcoind `SimpleHttpTransport`s +#[derive(Clone, Debug)] +pub struct Builder { + tp: SimpleHttpTransport, +} + +impl Builder { + /// Construct new `Builder` with default configuration + pub fn new() -> Builder { + Builder { + tp: SimpleHttpTransport::new(), + } + } + + /// Sets the timeout after which requests will abort if they aren't finished + /// The timeout does not apply when a proxy is set. + pub fn timeout(mut self, timeout: Duration) -> Self { + self.tp.timeout = timeout; + self + } + + /// Set the URL of the server to the transport. + pub fn url(mut self, url: &str) -> Result { + // Do some very basic manual URL parsing because the uri/url crates + // all have unicode-normalization as a dependency and that's broken. + + // The fallback port in case no port was provided. + // This changes when the http or https scheme was provided. + let mut fallback_port = DEFAULT_PORT; + + // We need to get the hostname and the port. + // (1) Split scheme + let after_scheme = { + let mut split = url.splitn(2, "://"); + let s = split.next().unwrap(); + match split.next() { + None => s, // no scheme present + Some(after) => { + // Check if the scheme is http or https. + if s == "http" { + fallback_port = 80; + } else if s == "https" { + fallback_port = 443; + } else { + return Err(Error::url(url, "scheme schould be http or https")); + } + after + } + } + }; + // (2) split off path + let (before_path, path) = { + if let Some(slash) = after_scheme.find("/") { + (&after_scheme[0..slash], &after_scheme[slash..]) + } else { + (after_scheme, "/") + } + }; + // (3) split off auth part + let after_auth = { + let mut split = before_path.splitn(2, "@"); + let s = split.next().unwrap(); + split.next().unwrap_or(s) + }; + // so now we should have : or just + let mut split = after_auth.split(":"); + let hostname = split.next().unwrap(); + let port: u16 = match split.next() { + Some(port_str) => match port_str.parse() { + Ok(port) => port, + Err(_) => return Err(Error::url(url, "invalid port")), + }, + None => fallback_port, + }; + // make sure we don't have a second colon in this part + if split.next().is_some() { + return Err(Error::url(url, "unexpected extra colon")); + } + + self.tp.addr = (hostname, port) + .to_target_addr() + .map_err(|_| Error::url(url, "invalid hostname: error extracting socket address"))?; + self.tp.path = path.to_owned(); + Ok(self) + } + + /// Add authentication information to the transport. + pub fn auth>(mut self, user: S, pass: Option) -> Self { + let mut auth = user.as_ref().to_owned(); + auth.push(':'); + if let Some(ref pass) = pass { + auth.push_str(&pass.as_ref()[..]); + } + self.tp.basic_auth = Some(format!("Basic {}", &base64::encode(auth.as_bytes()))); + self + } + + /// Add authentication information to the transport using a cookie string ('user:pass') + pub fn cookie_auth>(mut self, cookie: S) -> Self { + self.tp.basic_auth = Some(format!( + "Basic {}", + &base64::encode(cookie.as_ref().as_bytes()) + )); + self + } + + /// Set a SOCKS5H proxy. + /// This may block the current thread if hostname resolution is needed. + pub fn proxy(mut self, proxy_addr: S) -> Result { + self.tp.proxy_addr = + Some(resolve_first_addr(&proxy_addr).map_err(|_| Error::InvalidProxyAddr)?); + Ok(self) + } + + /// Builds the final `SimpleHttpTransport` + pub fn build(self) -> SimpleHttpTransport { + self.tp + } +} + +fn resolve_first_addr(addr: &S) -> io::Result { + addr.to_socket_addrs()?.next().ok_or_else(|| { + io::Error::new( + io::ErrorKind::InvalidInput, + "error extracting socket address", + ) + }) +} \ No newline at end of file diff --git a/src/util/mod.rs b/src/util/mod.rs index 622daf4..a7ef98b 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -17,6 +17,9 @@ pub mod progress; pub mod whitepaper; pub mod xpub; +#[cfg(feature = "proxy")] +pub mod jsonrpc_proxy; + pub use bitcoincore_ext::RpcApiExt; const VSIZE_BIN_WIDTH: u32 = 50_000; // vbytes From 5d276d4df567942e9bb3947338a614fbb95fdada Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 02:27:55 +0300 Subject: [PATCH 04/13] Update more crates --- Cargo.lock | 503 ++++++++++++++++-------------------- Cargo.toml | 6 +- src/app.rs | 3 +- src/config.rs | 4 +- src/util/bitcoincore_ext.rs | 4 +- src/util/jsonrpc_proxy.rs | 12 +- 6 files changed, 236 insertions(+), 296 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d68ce1a..b82c443 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] @@ -17,12 +17,12 @@ checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" [[package]] name = "android_logger" -version = "0.9.2" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ec2333c185d826313162cee39d3fcc6a84ba08114a839bebf53b961e7e75773" +checksum = "d9ed09b18365ed295d722d0b5ed59c01b79a826ff2d2a8f73d5ecca8e6fb2f66" dependencies = [ "android_log-sys", - "env_logger", + "env_logger 0.8.4", "lazy_static", "log", ] @@ -38,21 +38,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.39" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1" [[package]] name = "atty" @@ -140,20 +128,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "blake2b_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" @@ -176,9 +153,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.6.1" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +checksum = "d9df67f7bf9ef8498769f994239c45613ef0c5899415fb58e9add412d2c1a538" [[package]] name = "bwt" @@ -196,7 +173,7 @@ dependencies = [ "log", "miniscript", "pretty_env_logger", - "rand 0.8.3", + "rand 0.8.4", "reqwest", "serde", "serde_json", @@ -217,15 +194,15 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.67" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" [[package]] name = "cfg-if" @@ -258,12 +235,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - [[package]] name = "core-foundation" version = "0.9.1" @@ -281,20 +252,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - -[[package]] -name = "crossbeam-utils" -version = "0.8.3" +name = "cpufeatures" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" dependencies = [ - "autocfg", - "cfg-if", - "lazy_static", + "libc", ] [[package]] @@ -308,18 +271,18 @@ dependencies = [ [[package]] name = "dirs" -version = "3.0.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142995ed02755914747cc6ca76fc7e4583cd18578746716d0508ea6ed558b9ff" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ "libc", "redox_users", @@ -354,6 +317,16 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +dependencies = [ + "log", + "regex", +] + [[package]] name = "fnv" version = "1.0.7" @@ -387,9 +360,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" +checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" dependencies = [ "futures-channel", "futures-core", @@ -401,9 +374,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" +checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" dependencies = [ "futures-core", "futures-sink", @@ -411,34 +384,35 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" +checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" [[package]] name = "futures-io" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" +checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" [[package]] name = "futures-sink" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" +checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" [[package]] name = "futures-task" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" +checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" [[package]] name = "futures-util" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" +checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ + "autocfg", "futures-core", "futures-io", "futures-sink", @@ -472,9 +446,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", "libc", @@ -483,9 +457,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.1" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78" +checksum = "6c06815895acec637cd6ed6e9662c935b866d20a106f8361892893a7d9234964" dependencies = [ "bytes", "fnv", @@ -502,9 +476,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "headers" @@ -533,27 +507,27 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] name = "http" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ "bytes", "fnv", @@ -562,9 +536,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737" +checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" dependencies = [ "bytes", "http", @@ -573,15 +547,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.5" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" [[package]] name = "humantime" @@ -594,9 +568,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.4" +version = "0.14.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" +checksum = "15d1cfb9e4f68655fa04c01f59edb405b6074a0f7118ea881e5026e4a1cd8593" dependencies = [ "bytes", "futures-channel", @@ -608,7 +582,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project", + "pin-project-lite", "socket2", "tokio", "tower-service", @@ -631,9 +605,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -642,9 +616,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", "hashbrown", @@ -661,21 +635,21 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "js-sys" -version = "0.3.49" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" dependencies = [ "wasm-bindgen", ] @@ -700,9 +674,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.91" +version = "0.2.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" +checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6" [[package]] name = "log" @@ -715,15 +689,15 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "mime" @@ -753,9 +727,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", "log", @@ -793,9 +767,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ "lazy_static", "libc", @@ -849,9 +823,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "opaque-debug" @@ -861,9 +835,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.33" +version = "0.10.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" dependencies = [ "bitflags", "cfg-if", @@ -875,15 +849,15 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.61" +version = "0.9.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" +checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058" dependencies = [ "autocfg", "cc", @@ -900,18 +874,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "1.0.5" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" +checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.5" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" +checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" dependencies = [ "proc-macro2", "quote", @@ -920,9 +894,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -932,9 +906,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb" [[package]] name = "ppv-lite86" @@ -948,7 +922,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" dependencies = [ - "env_logger", + "env_logger 0.7.1", "log", ] @@ -978,9 +952,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" dependencies = [ "unicode-xid", ] @@ -993,9 +967,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ "proc-macro2", ] @@ -1015,14 +989,14 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", - "rand_hc 0.3.0", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", ] [[package]] @@ -1037,12 +1011,12 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -1056,11 +1030,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.2", + "getrandom 0.2.3", ] [[package]] @@ -1074,44 +1048,37 @@ dependencies = [ [[package]] name = "rand_hc" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.5" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom 0.1.16", - "redox_syscall 0.1.57", - "rust-argon2", + "getrandom 0.2.3", + "redox_syscall", ] [[package]] name = "regex" -version = "1.4.5" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr", @@ -1120,9 +1087,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.23" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "remove_dir_all" @@ -1135,9 +1102,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.2" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" +checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" dependencies = [ "base64", "bytes", @@ -1168,18 +1135,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "rust-argon2" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" -dependencies = [ - "base64", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", -] - [[package]] name = "ryu" version = "1.0.5" @@ -1220,18 +1175,18 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e4b6455ee49f5901c8985b88f98fb0a0e1d90a6661f5a03f4888bd987dad29" +checksum = "827cb7cce42533829c792fc51b82fbf18b125b45a702ef2c8be77fce65463a7b" dependencies = [ "cc", ] [[package]] name = "security-framework" -version = "2.1.2" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d493c5f39e02dfb062cd8f33301f90f9b13b650e8c1b1d0fd75c19dd64bff69d" +checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" dependencies = [ "bitflags", "core-foundation", @@ -1242,9 +1197,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.1.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee48cdde5ed250b0d3252818f646e174ab414036edb884dde62d80a3ac6082d" +checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" dependencies = [ "core-foundation-sys", "libc", @@ -1252,18 +1207,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.125" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.125" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -1272,9 +1227,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.64" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" dependencies = [ "itoa", "ryu", @@ -1295,22 +1250,22 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.4" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer", "cfg-if", - "cpuid-bool", + "cpufeatures", "digest", "opaque-debug", ] [[package]] name = "signal-hook" -version = "0.1.17" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" +checksum = "9c98891d737e271a2954825ef19e46bd16bdb98e2746f2eec4f7a4ef7946efd1" dependencies = [ "libc", "signal-hook-registry", @@ -1318,26 +1273,25 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", ] [[package]] name = "slab" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" [[package]] name = "socket2" -version = "0.3.19" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ - "cfg-if", "libc", "winapi 0.3.9", ] @@ -1362,9 +1316,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" +checksum = "bf9d950ef167e25e0bdb073cf1d68e9ad2795ac826f2f3f59647817cf23c0bfa" dependencies = [ "clap", "lazy_static", @@ -1373,9 +1327,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" +checksum = "134d838a2c9943ac3125cf6df165eda53493451b719f3255b2a26b85f772d0ba" dependencies = [ "heck", "proc-macro-error", @@ -1386,9 +1340,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.64" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" +checksum = "a4eac2e6c19f5c3abc0c229bea31ff0b9b091c7b14990e8924b92902a303a0c0" dependencies = [ "proc-macro2", "quote", @@ -1403,8 +1357,8 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if", "libc", - "rand 0.8.3", - "redox_syscall 0.2.5", + "rand 0.8.4", + "redox_syscall", "remove_dir_all", "winapi 0.3.9", ] @@ -1429,18 +1383,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.24" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.24" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c" dependencies = [ "proc-macro2", "quote", @@ -1459,9 +1413,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.1.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7" dependencies = [ "tinyvec_macros", ] @@ -1474,9 +1428,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.4.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" +checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc" dependencies = [ "autocfg", "bytes", @@ -1486,13 +1440,14 @@ dependencies = [ "num_cpus", "pin-project-lite", "tokio-macros", + "winapi 0.3.9", ] [[package]] name = "tokio-macros" -version = "1.1.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" +checksum = "154794c8f499c2619acd19e839294703e9e32e7630ef5f46ea80d4ef0fbee5eb" dependencies = [ "proc-macro2", "quote", @@ -1511,9 +1466,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e177a5d8c3bf36de9ebe6d58537d8879e964332f93fb3339e43f618c81361af0" +checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" dependencies = [ "futures-core", "pin-project-lite", @@ -1535,9 +1490,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" +checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" dependencies = [ "bytes", "futures-core", @@ -1555,9 +1510,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.25" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" +checksum = "84f96e095c0c82419687c20ddf5cb3eadb61f4e1405923c9dc8e53a1adacbda8" dependencies = [ "cfg-if", "log", @@ -1567,23 +1522,13 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.17" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.3" @@ -1603,7 +1548,7 @@ dependencies = [ "httparse", "input_buffer", "log", - "rand 0.8.3", + "rand 0.8.4", "sha-1", "url", "utf-8", @@ -1620,9 +1565,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] name = "unicase" @@ -1635,45 +1580,42 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] +checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" [[package]] name = "unicode-normalization" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "url" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", "idna", @@ -1683,15 +1625,15 @@ dependencies = [ [[package]] name = "utf-8" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "vcpkg" -version = "0.2.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vec_map" @@ -1717,9 +1659,9 @@ dependencies = [ [[package]] name = "warp" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dafd0aac2818a94a34df0df1100a7356c493d8ede4393875fd0b5c51bb6bc80" +checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054" dependencies = [ "bytes", "futures", @@ -1742,7 +1684,6 @@ dependencies = [ "tokio-util", "tower-service", "tracing", - "tracing-futures", ] [[package]] @@ -1759,9 +1700,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.72" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ "cfg-if", "serde", @@ -1771,9 +1712,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.72" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", @@ -1786,9 +1727,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.22" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468" +checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" dependencies = [ "cfg-if", "js-sys", @@ -1798,9 +1739,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.72" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1808,9 +1749,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.72" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", @@ -1821,15 +1762,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.72" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] name = "web-sys" -version = "0.3.49" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 8e97bac..4780909 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,15 +56,15 @@ socks = { version = "0.3.3", optional = true } reqwest = { version = "0.11.0", optional = true, features = ["json", "blocking"] } # android deps -android_logger = { version = "0.9.1", optional = true } +android_logger = { version = "0.10.1", optional = true } # cli/extra deps structopt = { version = "0.3.20", optional = true } dotenv = { version = "0.15.0", optional = true } -dirs = { version = "3.0.1", optional = true } +dirs = { version = "4.0.0", optional = true } pretty_env_logger = { version = "0.4.0", optional = true } [target.'cfg(unix)'.dependencies] -signal-hook = { version = "0.1.16", optional = true } +signal-hook = { version = "0.3.10", optional = true } # Statically link OpenSSL when cross-compiling to ARM # OpenSSL is currently disabled on ARM, see https://github.com/bwt-dev/bwt/issues/52 diff --git a/src/app.rs b/src/app.rs index 46cf1b8..435c2a4 100644 --- a/src/app.rs +++ b/src/app.rs @@ -286,9 +286,10 @@ impl App { #[cfg(all(unix, feature = "signal-hook"))] fn default_shutdown_signal(&self) -> Option> { + use signal_hook::consts::{SIGINT, SIGTERM}; use signal_hook::iterator::Signals; - let signals = Signals::new(&[signal_hook::SIGINT, signal_hook::SIGTERM]).unwrap(); + let mut signals = Signals::new(&[SIGINT, SIGTERM]).unwrap(); let (shutdown_tx, shutdown_rx) = mpsc::sync_channel(1); let sync_tx = self.sync_chan.0.clone(); diff --git a/src/config.rs b/src/config.rs index 4ef8a7e..5b2e8b4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -97,13 +97,13 @@ pub struct Config { )] pub bitcoind_cookie: Option, - /// Set a SOCKS5h proxy server for connecting to the Bitcoin Core RPC + /// SOCKS5h proxy server for connecting to the Bitcoin Core RPC #[cfg(feature = "proxy")] #[cfg_attr( feature = "cli", structopt(short = "P", long, env, hide_env_values(true), display_order(35)) )] - pub bitcoind_proxy: Option, + pub bitcoind_proxy: Option, /// Create the specified bitcoind wallet if it's missing [env: CREATE_WALLET_IF_MISSING] #[cfg_attr(feature = "cli", structopt(long, short = "W", display_order(1002)))] diff --git a/src/util/bitcoincore_ext.rs b/src/util/bitcoincore_ext.rs index 7dcbbca..9d42597 100644 --- a/src/util/bitcoincore_ext.rs +++ b/src/util/bitcoincore_ext.rs @@ -103,8 +103,8 @@ pub fn create_rpc_client(config: &crate::Config) -> Result } #[cfg(feature = "proxy")] - if let Some(proxy_addr) = &config.bitcoind_proxy { - builder = builder.proxy(proxy_addr)?; + if let Some(proxy_addr) = config.bitcoind_proxy { + builder = builder.proxy(proxy_addr); } Ok(Client::from_jsonrpc(jsonrpc::Client::with_transport( diff --git a/src/util/jsonrpc_proxy.rs b/src/util/jsonrpc_proxy.rs index 8b4ecea..3818070 100644 --- a/src/util/jsonrpc_proxy.rs +++ b/src/util/jsonrpc_proxy.rs @@ -59,8 +59,7 @@ impl SimpleHttpTransport { let mut sock = match self.proxy_addr { Some(proxy_addr) => Socks5Stream::connect(proxy_addr, self.addr.clone())?.into_inner(), None => { - let addr = resolve_first_addr(&self.addr) - .map_err(|_| Error::url(format!("{:?}", self.addr), "invalid hostname"))?; + let addr = resolve_first_addr(&self.addr)?; TcpStream::connect_timeout(&addr, self.timeout)? } }; @@ -342,10 +341,9 @@ impl Builder { /// Set a SOCKS5H proxy. /// This may block the current thread if hostname resolution is needed. - pub fn proxy(mut self, proxy_addr: S) -> Result { - self.tp.proxy_addr = - Some(resolve_first_addr(&proxy_addr).map_err(|_| Error::InvalidProxyAddr)?); - Ok(self) + pub fn proxy(mut self, proxy_addr: net::SocketAddr) -> Self { + self.tp.proxy_addr = Some(proxy_addr); + self } /// Builds the final `SimpleHttpTransport` @@ -361,4 +359,4 @@ fn resolve_first_addr(addr: &S) -> io::Result "error extracting socket address", ) }) -} \ No newline at end of file +} From 108924f27d1bd71495b05521f3e3a0eabdebde61 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 06:37:09 +0300 Subject: [PATCH 05/13] Remove dead code --- src/app.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/app.rs b/src/app.rs index 435c2a4..46c9799 100644 --- a/src/app.rs +++ b/src/app.rs @@ -155,18 +155,6 @@ impl App { .map(|webhook| webhook.send_updates(&updates)); } - // Try running 'pruneblockchain' until it succeeds, then stop - /* - if let Some(prune_until) = self.config.prune_until { - // XXX run less? - if self.pruning_pending.get() { - if let Ok(pruned) = self.query.rpc().prune_blockchain(prune_until) { - info!(target: LT, "Successfully pruned up to height {}", pruned); - self.pruning_pending.set(false); - } // will fail if the current tip is earlier than `prune_until` - } - }*/ - // Try pruning the chain (when 'prune-until' is set) self.try_prune()?; From 5f92c4717bdc474302305823dcf60fd3425ba8c0 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 06:13:11 +0300 Subject: [PATCH 06/13] New `--bitcoind-timeout ` option to control the RPC socket timeout --- CHANGELOG.md | 4 +++- src/config.rs | 9 ++++++++- src/util/bitcoincore_ext.rs | 4 ++++ src/util/jsonrpc_proxy.rs | 7 +++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01e699d..2e2ad7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ ## Unreleased -- Support connecting to the Bitcoin Core RPC through a proxy (#21) +- New `--bitcoind-proxy ` option for connecting to the Bitcoin Core RPC through a proxy (#21) + +- New `--bitcoind-timeout ` option to control the RPC socket timeout - Update to rust-bitcoin v0.27, rust-miniscript v6.0 and rust-bitcoincore-rpc v0.14 diff --git a/src/config.rs b/src/config.rs index 5b2e8b4..7dfddff 100644 --- a/src/config.rs +++ b/src/config.rs @@ -105,6 +105,13 @@ pub struct Config { )] pub bitcoind_proxy: Option, + /// The connect/read/write timeout for the RPC connection (in seconds) + #[cfg_attr( + feature = "cli", + structopt(short = "m", long, env, hide_env_values(true), display_order(36), parse(try_from_str = parse_duration)) + )] + pub bitcoind_timeout: Option, + /// Create the specified bitcoind wallet if it's missing [env: CREATE_WALLET_IF_MISSING] #[cfg_attr(feature = "cli", structopt(long, short = "W", display_order(1002)))] #[serde(default)] @@ -735,7 +742,7 @@ defaultable!(Config, @default( verbose, timestamp, broadcast_cmd, startup_banner, prune_until, descriptors, xpubs, addresses, addresses_file, force_rescan, - bitcoind_wallet, bitcoind_dir, bitcoind_url, bitcoind_auth, bitcoind_cookie, create_wallet_if_missing, + bitcoind_wallet, bitcoind_dir, bitcoind_url, bitcoind_auth, bitcoind_cookie, bitcoind_timeout, create_wallet_if_missing, auth_cookie, auth_token, auth_ephemeral, print_token, #[cfg(feature = "electrum")] electrum_addr, #[cfg(feature = "electrum")] electrum_skip_merkle, diff --git a/src/util/bitcoincore_ext.rs b/src/util/bitcoincore_ext.rs index 9d42597..1f783bf 100644 --- a/src/util/bitcoincore_ext.rs +++ b/src/util/bitcoincore_ext.rs @@ -102,6 +102,10 @@ pub fn create_rpc_client(config: &crate::Config) -> Result builder = builder.auth(user, pass); } + if let Some(timeout) = config.bitcoind_timeout { + builder = builder.timeout(timeout); + } + #[cfg(feature = "proxy")] if let Some(proxy_addr) = config.bitcoind_proxy { builder = builder.proxy(proxy_addr); diff --git a/src/util/jsonrpc_proxy.rs b/src/util/jsonrpc_proxy.rs index 3818070..ce34060 100644 --- a/src/util/jsonrpc_proxy.rs +++ b/src/util/jsonrpc_proxy.rs @@ -64,6 +64,9 @@ impl SimpleHttpTransport { } }; + sock.set_read_timeout(Some(self.timeout))?; + sock.set_write_timeout(Some(self.timeout))?; + // Serialize the body first so we can set the Content-Length header. let body = serde_json::to_vec(&req)?; @@ -247,8 +250,8 @@ impl Builder { } } - /// Sets the timeout after which requests will abort if they aren't finished - /// The timeout does not apply when a proxy is set. + /// Sets the connect/read/write timeout for the RPC socket + /// The connect timeout does not apply when a proxy is set. pub fn timeout(mut self, timeout: Duration) -> Self { self.tp.timeout = timeout; self From d9f3bb01dbe0d2b9db46550f10f4691a244c8de5 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 06:52:06 +0300 Subject: [PATCH 07/13] Enable the 'proxy' feature in build scripts, tests and docker --- README.md | 2 +- scripts/build.sh | 6 ++++-- scripts/check.sh | 6 +++--- scripts/docker-release.sh | 4 ++-- scripts/setup-env.sh | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c2f2b60..b213316 100644 --- a/README.md +++ b/README.md @@ -1263,7 +1263,7 @@ If you have [`cargo watch`](https://github.com/passcod/cargo-watch) installed, i ### Features -bwt has 7 optional features: `cli`, `http`, `electrum`, `webhooks`, `track-spends`, `ffi` and `extra`. +bwt has 7 optional features: `cli`, `http`, `electrum`, `webhooks`, `track-spends`, `proxy`, `ffi` and `extra`. All are enabled by default except for `webhooks` and `ffi`. diff --git a/scripts/build.sh b/scripts/build.sh index daaec8f..a190248 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,11 @@ #!/bin/bash set -xeo pipefail -# `x86_64-osx` is also available, but requires osxcross installed (see builder-osx.Dockerfile) +# `x86_64-osx` is also available, but requires osxcross to be installed (see builder-osx.Dockerfile) TARGETS=${TARGETS:-x86_64-linux,x86_64-windows,arm32v7-linux,arm64v8-linux} +BASE_FEATURES=${BASE_FEATURES:-cli,proxy} + if [[ -n "$SCCACHE_DIR" && -d "$SCCACHE_DIR" ]]; then export RUSTC_WRAPPER=$(which sccache) fi @@ -15,7 +17,7 @@ build() { echo Building $name for $target with features $features - cargo build --release --target $target --no-default-features --features "cli,$features" + cargo build --release --target $target --no-default-features --features "$BASE_FEATURES,$features" filename=bwt$([[ $2 == *"-windows-"* ]] && echo .exe || echo '') mv target/$target/release/$filename $dest/ diff --git a/scripts/check.sh b/scripts/check.sh index 9e08b8b..9bd1b81 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -3,11 +3,11 @@ cargo check cargo check --all-features -# All combos that include at least `cli` and one pf `http`/`electrum` -feature_combos="CH CE CEH CET CHT CHW CEW CEHT CEHW CETW CHTW CEHTW" +# All combos include at least `cli` and one of `http`/`electrum` +feature_combos="CH CE CEH CET CHT CHW CEW CEHT CEHW CETW CHTW CEHTW CEHTWP" for features in $feature_combos; do - features=`echo $features | sed 's/H/http /; s/E/electrum /; s/W/webhooks /; s/T/track-spends /; s/C/cli /;'` + features=`echo $features | sed 's/H/http /; s/E/electrum /; s/W/webhooks /; s/T/track-spends /; s/C/cli /; s/P/proxy /;'` echo "Checking $features" cargo check --no-default-features --features "$features" done diff --git a/scripts/docker-release.sh b/scripts/docker-release.sh index 2c383a8..853f0a7 100755 --- a/scripts/docker-release.sh +++ b/scripts/docker-release.sh @@ -40,5 +40,5 @@ build() { docker push $docker_tag } -build_variant $base_tag $docker_name:latest http,electrum,webhooks,track-spends '' -build_variant $base_tag-electrum $docker_name:electrum electrum '-electrum_only' +build_variant $base_tag $docker_name:latest http,electrum,webhooks,track-spends,proxy '' +build_variant $base_tag-electrum $docker_name:electrum electrum,proxy '-electrum_only' diff --git a/scripts/setup-env.sh b/scripts/setup-env.sh index 3b3da63..68fc6cd 100755 --- a/scripts/setup-env.sh +++ b/scripts/setup-env.sh @@ -5,7 +5,7 @@ shopt -s expand_aliases (command -v electrum && command -v bitcoind && command -v bitcoin-cli) > /dev/null \ || { echo >&2 "bitcoind, bitcoin-cli and electrum must be installed in PATH"; exit 1; } -export FEATURES=cli,${FEATURES:-http,electrum,webhooks,track-spends} +export FEATURES=cli,${FEATURES:-http,electrum,webhooks,proxy,track-spends} if [ -z "$DIR" ]; then DIR=`mktemp -d --suffix -bwt-env` From 9e620d3774c21aec6083553e8381777509fd51c8 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 06:53:09 +0300 Subject: [PATCH 08/13] Fix the docker-generate script and re-run it --- docker/arm32v7.Dockerfile | 3 +++ docker/arm64v8.Dockerfile | 3 +++ scripts/docker-generate.sh | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docker/arm32v7.Dockerfile b/docker/arm32v7.Dockerfile index 37d2856..279ce83 100644 --- a/docker/arm32v7.Dockerfile +++ b/docker/arm32v7.Dockerfile @@ -14,3 +14,6 @@ ARG FEATURES=electrum,http,webhooks,track-spends RUN echo $FEATURES | grep -v webhooks > /dev/null || (apt-get update && apt-get install -y libssl-dev) COPY --from=builder /usr/local/bin/bwt /usr/local/bin/ ENTRYPOINT [ "bwt", "--bitcoind-dir", "/bitcoin" ] + +# The ARM32v7/ARM32v8 dockerfiles are automatically generated from the main Docker, +# see scripts/docker-generate.sh diff --git a/docker/arm64v8.Dockerfile b/docker/arm64v8.Dockerfile index 7a5807c..8a5b56b 100644 --- a/docker/arm64v8.Dockerfile +++ b/docker/arm64v8.Dockerfile @@ -14,3 +14,6 @@ ARG FEATURES=electrum,http,webhooks,track-spends RUN echo $FEATURES | grep -v webhooks > /dev/null || (apt-get update && apt-get install -y libssl-dev) COPY --from=builder /usr/local/bin/bwt /usr/local/bin/ ENTRYPOINT [ "bwt", "--bitcoind-dir", "/bitcoin" ] + +# The ARM32v7/ARM32v8 dockerfiles are automatically generated from the main Docker, +# see scripts/docker-generate.sh diff --git a/scripts/docker-generate.sh b/scripts/docker-generate.sh index 37ab9a5..a5fc5bb 100755 --- a/scripts/docker-generate.sh +++ b/scripts/docker-generate.sh @@ -13,11 +13,11 @@ generate_dockerfile() { # https://hub.docker.com/r/arm32v7/debian/tags?name=buster-slim generate_dockerfile 58cb29151843a8ba8e0e78e3f80096ed2f9514cf81d4f85ef43727140631e67b \ d31590f680577ffde6bd08943e9590eaabdc04529ea60f4bb6f58cddbc33f628 \ - > dockerfiles/arm32v7.Dockerfile + > docker/arm32v7.Dockerfile # arm64v8/rust:1.49.0-slim and arm64v8/debian:buster-slim (10.7) # https://hub.docker.com/r/arm64v8/rust/tags?name=slim # https://hub.docker.com/r/arm64v8/debian/tags?name=buster-slim generate_dockerfile 2a44876432ba0cfbe7f7fcddd9b16f316ee13abecdee43b25f0645529966bc40 \ 01b65c2928fed9427e59a679e287a75d98551ea2061cf03c61be0c7e1fc40fef \ - > dockerfiles/arm64v8.Dockerfile + > docker/arm64v8.Dockerfile From bf04dbc1b240c3f4300033ea284e4839a0b146dc Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 06:57:30 +0300 Subject: [PATCH 09/13] Support specifying the proxy address as an hostname --- src/config.rs | 2 +- src/util/bitcoincore_ext.rs | 4 ++-- src/util/jsonrpc_proxy.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/config.rs b/src/config.rs index 7dfddff..b526cf4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -103,7 +103,7 @@ pub struct Config { feature = "cli", structopt(short = "P", long, env, hide_env_values(true), display_order(35)) )] - pub bitcoind_proxy: Option, + pub bitcoind_proxy: Option, /// The connect/read/write timeout for the RPC connection (in seconds) #[cfg_attr( diff --git a/src/util/bitcoincore_ext.rs b/src/util/bitcoincore_ext.rs index 1f783bf..3ed5a35 100644 --- a/src/util/bitcoincore_ext.rs +++ b/src/util/bitcoincore_ext.rs @@ -107,8 +107,8 @@ pub fn create_rpc_client(config: &crate::Config) -> Result } #[cfg(feature = "proxy")] - if let Some(proxy_addr) = config.bitcoind_proxy { - builder = builder.proxy(proxy_addr); + if let Some(proxy_addr) = &config.bitcoind_proxy { + builder = builder.proxy(proxy_addr)?; } Ok(Client::from_jsonrpc(jsonrpc::Client::with_transport( diff --git a/src/util/jsonrpc_proxy.rs b/src/util/jsonrpc_proxy.rs index ce34060..8bfd103 100644 --- a/src/util/jsonrpc_proxy.rs +++ b/src/util/jsonrpc_proxy.rs @@ -344,9 +344,9 @@ impl Builder { /// Set a SOCKS5H proxy. /// This may block the current thread if hostname resolution is needed. - pub fn proxy(mut self, proxy_addr: net::SocketAddr) -> Self { - self.tp.proxy_addr = Some(proxy_addr); - self + pub fn proxy(mut self, proxy_addr: S) -> Result { + self.tp.proxy_addr = Some(resolve_first_addr(&proxy_addr)?); + Ok(self) } /// Builds the final `SimpleHttpTransport` From c0b733ec431c945893bebaa290d9b748b89f8f05 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 19:33:12 +0300 Subject: [PATCH 10/13] Disable the default RPC socket timeout when --bitcoind--timeout is not set --- src/util/jsonrpc_proxy.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/util/jsonrpc_proxy.rs b/src/util/jsonrpc_proxy.rs index 8bfd103..eafe814 100644 --- a/src/util/jsonrpc_proxy.rs +++ b/src/util/jsonrpc_proxy.rs @@ -21,7 +21,7 @@ pub const DEFAULT_PORT: u16 = 8332; pub struct SimpleHttpTransport { addr: TargetAddr, path: String, - timeout: Duration, + timeout: Option, /// The value of the `Authorization` HTTP header. basic_auth: Option, proxy_addr: Option, @@ -32,7 +32,7 @@ impl Default for SimpleHttpTransport { SimpleHttpTransport { addr: TargetAddr::Ip(([127, 0, 0, 1], DEFAULT_PORT).into()), path: "/".to_owned(), - timeout: Duration::from_secs(15), + timeout: None, basic_auth: None, proxy_addr: None, } @@ -55,17 +55,20 @@ impl SimpleHttpTransport { R: for<'a> serde::de::Deserialize<'a>, { // Open connection - let request_deadline = Instant::now() + self.timeout; + let request_deadline = self.timeout.map(|timeout| Instant::now() + timeout); let mut sock = match self.proxy_addr { Some(proxy_addr) => Socks5Stream::connect(proxy_addr, self.addr.clone())?.into_inner(), - None => { - let addr = resolve_first_addr(&self.addr)?; - TcpStream::connect_timeout(&addr, self.timeout)? - } + None => match self.timeout { + Some(timeout) => { + let addr = resolve_first_addr(&self.addr)?; + TcpStream::connect_timeout(&addr, timeout)? + } + None => TcpStream::connect(&self.addr)?, + }, }; - sock.set_read_timeout(Some(self.timeout))?; - sock.set_write_timeout(Some(self.timeout))?; + sock.set_read_timeout(self.timeout)?; + sock.set_write_timeout(self.timeout)?; // Serialize the body first so we can set the Content-Length header. let body = serde_json::to_vec(&req)?; @@ -198,9 +201,9 @@ impl From for jsonrpc::Error { /// Try to read a line from a buffered reader. If no line can be read till the deadline is reached /// return a timeout error. -fn get_line(reader: &mut R, deadline: Instant) -> Result { +fn get_line(reader: &mut R, deadline: Option) -> Result { let mut line = String::new(); - while deadline > Instant::now() { + while deadline.map_or(true, |d| d > Instant::now()) { match reader.read_line(&mut line) { // EOF reached for now, try again later Ok(0) => thread::sleep(Duration::from_millis(5)), @@ -253,7 +256,7 @@ impl Builder { /// Sets the connect/read/write timeout for the RPC socket /// The connect timeout does not apply when a proxy is set. pub fn timeout(mut self, timeout: Duration) -> Self { - self.tp.timeout = timeout; + self.tp.timeout = Some(timeout); self } From 6be05b82bc156a94201b21c24529b1529d5347f6 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Wed, 6 Oct 2021 19:37:11 +0300 Subject: [PATCH 11/13] Parse duration fields in JSON as an integer seconds --- src/config.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index b526cf4..7ac2f4b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -110,6 +110,7 @@ pub struct Config { feature = "cli", structopt(short = "m", long, env, hide_env_values(true), display_order(36), parse(try_from_str = parse_duration)) )] + #[serde(default, deserialize_with = "parse_duration_serde_opt")] pub bitcoind_timeout: Option, /// Create the specified bitcoind wallet if it's missing [env: CREATE_WALLET_IF_MISSING] @@ -323,7 +324,10 @@ pub struct Config { env, hide_env_values(true), display_order(90) ))] - #[serde(default = "default_poll_interval")] + #[serde( + default = "default_poll_interval", + deserialize_with = "parse_duration_serde" + )] pub poll_interval: time::Duration, /// Custom command for broadcasting transactions. {tx_hex} is replaced with the transaction. @@ -695,6 +699,24 @@ fn parse_duration(s: &str) -> Result { Ok(time::Duration::from_secs(s.parse()?)) } +fn parse_duration_serde<'de, D>(deserializer: D) -> std::result::Result +where + D: serde::Deserializer<'de>, +{ + use serde::Deserialize; + let secs = u64::deserialize(deserializer)?; + Ok(time::Duration::from_secs(secs)) +} + +fn parse_duration_serde_opt<'de, D>( + deserializer: D, +) -> std::result::Result, D::Error> +where + D: serde::Deserializer<'de>, +{ + Ok(Some(parse_duration_serde(deserializer)?)) +} + fn get_cookie(config: &Config) -> Option { let mut dir = config.bitcoind_dir.clone().or_else(bitcoind_default_dir)?; match config.network { From b7ffc6ad032c5e1e04207baaa250a4465c8d6fd0 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Tue, 29 Mar 2022 13:44:17 +0300 Subject: [PATCH 12/13] Implement temporary fix for createwallet (#95) Pending https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/174 --- src/app.rs | 2 +- src/util/bitcoincore_ext.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 46c9799..c9ed834 100644 --- a/src/app.rs +++ b/src/app.rs @@ -320,7 +320,7 @@ fn load_wallet(rpc: &RpcClient, name: &str, create_if_missing: bool) -> Result<( if create_if_missing && e.code == RPC_WALLET_NOT_FOUND => { info!(target: "bwt::wallet", "wallet '{}' does not exists, creating it", name); - rpc.create_wallet(name, Some(true), Some(true), None, None)?; + rpc.create_wallet_(name)?; Ok(()) } Err(e) => Err(e.into()), diff --git a/src/util/bitcoincore_ext.rs b/src/util/bitcoincore_ext.rs index 3ed5a35..35fd055 100644 --- a/src/util/bitcoincore_ext.rs +++ b/src/util/bitcoincore_ext.rs @@ -88,6 +88,23 @@ pub trait RpcApiExt: RpcApi { ) } + // Pending https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/174 + fn create_wallet_(&self, wallet_name: &str) -> RpcResult { + // Create with disable_private_keys=true, blank=true, descriptors=false + self.call( + "createwallet", + &[ + json!(wallet_name), + true.into(), + true.into(), + json!(""), + false.into(), + false.into(), + json!(null), + ], + ) + } + fn prune_blockchain(&self, until: u64) -> RpcResult { self.call("pruneblockchain", &[json!(until)]) } From e1885d97eb70c8f84db3383e7e2d04ad063f3ec0 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Thu, 31 Mar 2022 20:21:13 +0300 Subject: [PATCH 13/13] Prefer using fees.base for getrawmempool entries (#97) The old 'fee' field is deprecated as of Bitcoin Core v23.0: https://github.com/bitcoin-core/bitcoin-devwiki/wiki/23.0-Release-Notes-draft#updated-rpcs Fixes #96 --- src/util/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/mod.rs b/src/util/mod.rs index a7ef98b..c52ebdd 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -32,8 +32,11 @@ pub fn make_fee_histogram(mempool_entries: HashMap) -> Vec<(f32, u3 let vsize = entry["vsize"] .as_u64() .or_else(|| entry["size"].as_u64()) - .unwrap(); // bitcoind is borked if this fails - let fee = entry["fee"].as_f64().unwrap(); + .expect("invalid getrawmempool from bitcoind"); + let fee = entry["fees"]["base"] + .as_f64() + .or_else(|| entry["fee"].as_f64()) + .expect("invalid getrawmempool from bitcoind"); let feerate = fee as f32 / vsize as f32 * 100_000_000f32; (vsize as u32, feerate) })