From d5552528fd715e30de168216117b2dc739362a64 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Mar 2023 17:02:44 +0000 Subject: [PATCH 1/5] Fixup of negate command for new deps --- src/bin/hal/cmd/key.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/bin/hal/cmd/key.rs b/src/bin/hal/cmd/key.rs index ef82550..eb59fc5 100644 --- a/src/bin/hal/cmd/key.rs +++ b/src/bin/hal/cmd/key.rs @@ -215,11 +215,7 @@ fn exec_negate_pubkey<'a>(matches: &clap::ArgMatches<'a>) { let key = PublicKey::from_str(&s).expect("invalid public key"); let secp = secp256k1::Secp256k1::new(); - let negated = { - let mut key = key.key.clone(); - key.negate_assign(&secp); - key - }; + let negated = key.inner.negate(&secp); write!(::std::io::stdout(), "{}", negated).expect("failed to write stdout"); } From 4b9aa8b4be415c044a0d07e9227ac2ae2ab73421 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Mar 2023 16:34:58 +0000 Subject: [PATCH 2/5] Revert many unnecessary dependency changes --- Cargo.lock | 367 +++++++++++------------------------------------------ 1 file changed, 77 insertions(+), 290 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4128b5..d78d855 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,21 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "ansi_term" -version = "0.12.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ "winapi", ] @@ -33,9 +22,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "base64-compat" @@ -60,11 +49,11 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bip39" -version = "1.1.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5b9d9748b5770d1539657653dc5ac3cd9353549e74238dc0d96c22919128b94" +checksum = "b9e89470017230c38e52b82b3ee3f530db1856ba1d434e3a67a3456a8a8dec5f" dependencies = [ - "bitcoin_hashes 0.11.0", + "bitcoin_hashes 0.9.4", "rand_core 0.4.2", "serde", "unicode-normalization", @@ -84,9 +73,9 @@ dependencies = [ [[package]] name = "bitcoin_hashes" -version = "0.9.7" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce18265ec2324ad075345d5814fbeed4f41f0a660055dc78840b74d19b874b1" +checksum = "0aaf87b776808e26ae93289bc7d025092b6d909c193f0cdee0b3a86e7bd3c776" [[package]] name = "bitcoin_hashes" @@ -99,27 +88,21 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bumpalo" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "8dae9c4b8fedcae85592ba623c4fd08cfdab3e3b72d6df780c6ead964a69bfff" [[package]] name = "cfg-if" @@ -129,25 +112,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "iana-time-zone", - "js-sys", + "libc", "num-integer", "num-traits", "serde", "time", - "wasm-bindgen", "winapi", ] [[package]] name = "clap" -version = "2.34.0" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ "ansi_term", "atty", @@ -159,64 +140,10 @@ dependencies = [ ] [[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "cxx" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.91" +name = "dtoa" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" [[package]] name = "fern" @@ -258,17 +185,11 @@ dependencies = [ "shell-escape", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -279,69 +200,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" -[[package]] -name = "iana-time-zone" -version = "0.1.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown", -] - [[package]] name = "itoa" -version = "1.0.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "60af5f849e1981434e4a31d3d782c4774ae9b434ce55b101a96ecfd09147e8be" dependencies = [ "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", + "log", + "rand", ] [[package]] name = "libc" -version = "0.2.139" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" [[package]] name = "lightning-invoice" @@ -350,31 +230,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72828c99432e342f067b9661f556ce9667230565c88297c0b4e8a4541ffc0bd0" dependencies = [ "bech32 0.7.3", - "bitcoin_hashes 0.9.7", + "bitcoin_hashes 0.9.4", "num-traits", "secp256k1 0.20.3", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linked-hash-map" -version = "0.5.6" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "log" -version = "0.4.17" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ "cfg-if", ] @@ -387,18 +258,18 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "miniscript" -version = "9.0.0" +version = "9.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123a10aae81d0712ecc09b780f6f0ae0b0f506a5c4c912974725760d59ba073e" +checksum = "b9601439f168c13bdc5bf84349c2e61c815be4a4dcebe8c4ff4af58f4e8a6d20" dependencies = [ "bitcoin", ] [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ "autocfg", "num-traits", @@ -406,33 +277,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ - "unicode-ident", + "unicode-xid", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] @@ -476,15 +341,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "scratch" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "secp256k1" @@ -492,7 +351,7 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" dependencies = [ - "secp256k1-sys 0.4.2", + "secp256k1-sys 0.4.0", ] [[package]] @@ -508,9 +367,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.4.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +checksum = "67e4b6455ee49f5901c8985b88f98fb0a0e1d90a6661f5a03f4888bd987dad29" dependencies = [ "cc", ] @@ -526,18 +385,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.152" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ "proc-macro2", "quote", @@ -546,9 +405,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.93" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "itoa", "ryu", @@ -557,12 +416,12 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.26" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" +checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" dependencies = [ - "indexmap", - "ryu", + "dtoa", + "linked-hash-map", "serde", "yaml-rust", ] @@ -590,22 +449,13 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.109" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" dependencies = [ "proc-macro2", "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", + "unicode-xid", ] [[package]] @@ -619,21 +469,15 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi", "winapi", ] -[[package]] -name = "unicode-ident" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" - [[package]] name = "unicode-normalization" version = "0.1.9" @@ -645,9 +489,15 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "unicode-xid" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "vec_map" @@ -661,60 +511,6 @@ version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" -[[package]] -name = "wasm-bindgen" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - [[package]] name = "winapi" version = "0.3.9" @@ -731,15 +527,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" From 0bb5f8d2c14ecdeb7958e9129e1624db98e80df7 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sun, 12 Mar 2023 20:38:51 +0000 Subject: [PATCH 3/5] Enable Rust edition 2018 --- Cargo.toml | 1 + src/address.rs | 4 +++- src/bech32.rs | 6 +++-- src/bin/hal/cmd/address.rs | 2 +- src/bin/hal/cmd/bech32.rs | 3 +-- src/bin/hal/cmd/bip32.rs | 2 +- src/bin/hal/cmd/bip39.rs | 2 +- src/bin/hal/cmd/block.rs | 5 ++--- src/bin/hal/cmd/key.rs | 2 +- src/bin/hal/cmd/ln.rs | 3 +-- src/bin/hal/cmd/message.rs | 3 +-- src/bin/hal/cmd/miniscript.rs | 3 +-- src/bin/hal/cmd/psbt.rs | 3 +-- src/bin/hal/cmd/script.rs | 2 +- src/bin/hal/cmd/tx.rs | 3 +-- src/bin/hal/util.rs | 2 +- src/bip32.rs | 4 +++- src/bip39.rs | 12 +++++----- src/block.rs | 9 ++++---- src/key.rs | 10 ++++----- src/lightning.rs | 21 ++++++++++-------- src/miniscript.rs | 10 +++++---- src/psbt.rs | 42 ++++++++++++++++++----------------- src/tx.rs | 18 ++++++++------- 24 files changed, 92 insertions(+), 80 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 46c772c..2844740 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/stevenroose/hal/" description = "hal - the Bitcoin companion" keywords = [ "crypto", "bitcoin" ] readme = "README.md" +edition = "2018" [lib] name = "hal" diff --git a/src/address.rs b/src/address.rs index a8c1378..836f60a 100644 --- a/src/address.rs +++ b/src/address.rs @@ -1,12 +1,14 @@ use bitcoin::{self, Address, Network, Script, PubkeyHash, ScriptHash, WPubkeyHash, WScriptHash}; use serde::{Deserialize, Serialize}; +use crate::tx; + #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct AddressInfo { pub network: Network, #[serde(rename = "type")] pub type_: Option, - pub script_pub_key: ::tx::OutputScriptInfo, + pub script_pub_key: tx::OutputScriptInfo, #[serde(skip_serializing_if = "Option::is_none")] pub witness_program_version: Option, #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/bech32.rs b/src/bech32.rs index da02734..186f301 100644 --- a/src/bech32.rs +++ b/src/bech32.rs @@ -1,5 +1,7 @@ use serde::{Deserialize, Serialize}; +use crate::HexBytes; + #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct Bech32Info { /// Bech32 encoded string @@ -7,8 +9,8 @@ pub struct Bech32Info { /// Human-readable part pub hrp: String, /// Hex-encoded data payload in base32 - pub payload: ::HexBytes, + pub payload: HexBytes, /// Hex-encoded data payload in base256 #[serde(skip_serializing_if = "Option::is_none")] - pub payload_bytes: Option<::HexBytes>, + pub payload_bytes: Option, } diff --git a/src/bin/hal/cmd/address.rs b/src/bin/hal/cmd/address.rs index 1485028..4cb3248 100644 --- a/src/bin/hal/cmd/address.rs +++ b/src/bin/hal/cmd/address.rs @@ -2,8 +2,8 @@ use bitcoin::hashes::Hash; use bitcoin::{Address, PublicKey, WPubkeyHash, WScriptHash}; use clap; -use cmd; use hal; +use crate::cmd; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("address", "work with addresses") diff --git a/src/bin/hal/cmd/bech32.rs b/src/bin/hal/cmd/bech32.rs index ac292d9..5201736 100644 --- a/src/bin/hal/cmd/bech32.rs +++ b/src/bin/hal/cmd/bech32.rs @@ -2,9 +2,8 @@ use bitcoin::bech32::{decode, encode, CheckBase32, FromBase32, ToBase32, Variant use clap; use hex; -use cmd; use hal; -use util; +use crate::{cmd, util}; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("bech32", "encode and decode the bech32 format") diff --git a/src/bin/hal/cmd/bip32.rs b/src/bin/hal/cmd/bip32.rs index b640ca2..f37ebee 100644 --- a/src/bin/hal/cmd/bip32.rs +++ b/src/bin/hal/cmd/bip32.rs @@ -4,7 +4,7 @@ use bitcoin::secp256k1; use bitcoin::util::bip32; use clap; -use cmd; +use crate::cmd; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("bip32", "BIP-32 key derivation") diff --git a/src/bin/hal/cmd/bip39.rs b/src/bin/hal/cmd/bip39.rs index c7331c8..b19fd30 100644 --- a/src/bin/hal/cmd/bip39.rs +++ b/src/bin/hal/cmd/bip39.rs @@ -6,8 +6,8 @@ use clap; use hex; use rand::Rng; -use cmd; use hal; +use crate::cmd; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("bip39", "BIP-39 mnemonics") diff --git a/src/bin/hal/cmd/block.rs b/src/bin/hal/cmd/block.rs index 9f01480..1e476da 100644 --- a/src/bin/hal/cmd/block.rs +++ b/src/bin/hal/cmd/block.rs @@ -3,10 +3,9 @@ use std::io::Write; use bitcoin::consensus::encode::{deserialize, serialize}; use bitcoin::{Block, BlockHeader}; -use cmd; -use cmd::tx::create_transaction; -use util; use hal::block::{BlockHeaderInfo, BlockInfo}; +use crate::{cmd, util}; +use crate::cmd::tx::create_transaction; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("block", "manipulate blocks") diff --git a/src/bin/hal/cmd/key.rs b/src/bin/hal/cmd/key.rs index eb59fc5..198aee2 100644 --- a/src/bin/hal/cmd/key.rs +++ b/src/bin/hal/cmd/key.rs @@ -7,8 +7,8 @@ use bitcoin::{PrivateKey, PublicKey}; use clap; use rand; -use cmd; use hal; +use crate::cmd; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("key", "work with private and public keys") diff --git a/src/bin/hal/cmd/ln.rs b/src/bin/hal/cmd/ln.rs index 4f322df..fc1c982 100644 --- a/src/bin/hal/cmd/ln.rs +++ b/src/bin/hal/cmd/ln.rs @@ -1,8 +1,7 @@ use clap; use lightning_invoice::Invoice; -use cmd; -use util; +use crate::{cmd, util}; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("ln", "everything Lightning").subcommand( diff --git a/src/bin/hal/cmd/message.rs b/src/bin/hal/cmd/message.rs index 4aae7c7..eeaaec0 100644 --- a/src/bin/hal/cmd/message.rs +++ b/src/bin/hal/cmd/message.rs @@ -4,8 +4,7 @@ use bitcoin::secp256k1; use bitcoin::{Address, AddressType, PrivateKey, PublicKey}; use clap; -use cmd; -use util; +use crate::{cmd, util}; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("message", "Bitcoin Signed Messages") diff --git a/src/bin/hal/cmd/miniscript.rs b/src/bin/hal/cmd/miniscript.rs index 5758716..bdad50c 100644 --- a/src/bin/hal/cmd/miniscript.rs +++ b/src/bin/hal/cmd/miniscript.rs @@ -8,8 +8,7 @@ use miniscript::miniscript::{BareCtx, Legacy, Miniscript, Segwitv0}; use miniscript::policy::Liftable; use miniscript::{Descriptor, policy, MiniscriptKey}; -use cmd; -use util; +use crate::{cmd, util}; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("miniscript", "work with miniscript (alias: ms)") diff --git a/src/bin/hal/cmd/psbt.rs b/src/bin/hal/cmd/psbt.rs index ffaf923..ee2a1cc 100644 --- a/src/bin/hal/cmd/psbt.rs +++ b/src/bin/hal/cmd/psbt.rs @@ -13,8 +13,7 @@ use bitcoin::{PublicKey, Transaction}; use miniscript::psbt::PsbtExt; use secp256k1; -use cmd; -use util; +use crate::{cmd, util}; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("psbt", "partially signed Bitcoin transactions") diff --git a/src/bin/hal/cmd/script.rs b/src/bin/hal/cmd/script.rs index cddef6b..11c071f 100644 --- a/src/bin/hal/cmd/script.rs +++ b/src/bin/hal/cmd/script.rs @@ -2,7 +2,7 @@ use bitcoin::Script; use clap; use hex; -use cmd; +use crate::cmd; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("script", "manipulate scripts").subcommand(cmd_decode()) diff --git a/src/bin/hal/cmd/tx.rs b/src/bin/hal/cmd/tx.rs index baeccb9..dab0acb 100644 --- a/src/bin/hal/cmd/tx.rs +++ b/src/bin/hal/cmd/tx.rs @@ -4,9 +4,8 @@ use std::io::Write; use bitcoin::consensus::encode::{deserialize, serialize}; use bitcoin::{Network, OutPoint, Script, Transaction, TxIn, TxOut}; -use cmd; use hal::tx::{InputInfo, InputScriptInfo, OutputInfo, OutputScriptInfo, TransactionInfo}; -use util; +use crate::{cmd, util}; pub fn subcommand<'a>() -> clap::App<'a, 'a> { cmd::subcommand_group("tx", "manipulate transactions") diff --git a/src/bin/hal/util.rs b/src/bin/hal/util.rs index 6991929..d447b8c 100644 --- a/src/bin/hal/util.rs +++ b/src/bin/hal/util.rs @@ -6,7 +6,7 @@ use std::fs; use std::io::Read; use std::path::{Path, PathBuf}; -use cmd; +use crate::cmd; #[derive(PartialEq, PartialOrd, Eq, Ord)] pub enum CommandInfo { diff --git a/src/bip32.rs b/src/bip32.rs index bfb8c17..0385971 100644 --- a/src/bip32.rs +++ b/src/bip32.rs @@ -2,6 +2,8 @@ use bitcoin::Network; use bitcoin::util::bip32; use serde::{Deserialize, Serialize}; +use crate::address; + #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct DerivationInfo { pub network: Network, @@ -18,5 +20,5 @@ pub struct DerivationInfo { pub public_key: bitcoin::secp256k1::PublicKey, #[serde(skip_serializing_if = "Option::is_none")] pub private_key: Option, - pub addresses: ::address::Addresses, + pub addresses: address::Addresses, } diff --git a/src/bip39.rs b/src/bip39.rs index c047857..80f23eb 100644 --- a/src/bip39.rs +++ b/src/bip39.rs @@ -2,10 +2,12 @@ use bip39lib::{Language, Mnemonic}; use bitcoin::{secp256k1, util::bip32, Network}; use serde::{Deserialize, Serialize}; +use crate::{GetInfo, HexBytes}; + #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct MnemonicInfo { pub mnemonic: String, - pub entropy: ::HexBytes, + pub entropy: HexBytes, pub entropy_bits: usize, pub language: &'static str, pub passphrase: String, @@ -35,12 +37,12 @@ impl MnemonicInfo { Language::TraditionalChinese => "traditional-chinese", }, passphrase: passphrase.to_owned(), - seed: ::GetInfo::get_info(&mnemonic.to_seed(passphrase), network), + seed: GetInfo::get_info(&mnemonic.to_seed(passphrase), network), } } } -impl ::GetInfo for Mnemonic { +impl GetInfo for Mnemonic { fn get_info(&self, network: Network) -> MnemonicInfo { MnemonicInfo::from_mnemonic_with_passphrase(self, "", network) } @@ -48,12 +50,12 @@ impl ::GetInfo for Mnemonic { #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct SeedInfo { - pub seed: ::HexBytes, + pub seed: HexBytes, pub bip32_xpriv: bip32::ExtendedPrivKey, pub bip32_xpub: bip32::ExtendedPubKey, } -impl ::GetInfo for [u8; 64] { +impl GetInfo for [u8; 64] { fn get_info(&self, network: Network) -> SeedInfo { let xpriv = bip32::ExtendedPrivKey::new_master(network, &self[..]).unwrap(); let xpub = diff --git a/src/block.rs b/src/block.rs index 0edcb31..6489eab 100644 --- a/src/block.rs +++ b/src/block.rs @@ -1,7 +1,8 @@ use bitcoin::{Block, BlockHash, BlockHeader, Network, TxMerkleNode, Txid}; use serde::{Deserialize, Serialize}; -use tx::TransactionInfo; +use crate::tx::TransactionInfo; +use crate::{GetInfo, HexBytes}; #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct BlockHeaderInfo { @@ -15,7 +16,7 @@ pub struct BlockHeaderInfo { pub nonce: u32, } -impl<'a> ::GetInfo for BlockHeader { +impl<'a> GetInfo for BlockHeader { fn get_info(&self, _network: Network) -> BlockHeaderInfo { BlockHeaderInfo { block_hash: Some(self.block_hash()), @@ -38,10 +39,10 @@ pub struct BlockInfo { #[serde(skip_serializing_if = "Option::is_none")] pub txids: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub raw_transactions: Option>, + pub raw_transactions: Option>, } -impl ::GetInfo for Block { +impl GetInfo for Block { fn get_info(&self, network: Network) -> BlockInfo { BlockInfo { header: self.header.get_info(network), diff --git a/src/key.rs b/src/key.rs index 07762de..4f9b8ff 100644 --- a/src/key.rs +++ b/src/key.rs @@ -1,11 +1,11 @@ use bitcoin::{Network, PrivateKey, PublicKey}; use serde::{Deserialize, Serialize}; -use address; +use crate::{address, GetInfo, HexBytes}; #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct KeyInfo { - pub raw_private_key: ::HexBytes, + pub raw_private_key: HexBytes, #[serde(skip_serializing_if = "Option::is_none")] pub wif_private_key: Option, pub public_key: PublicKey, @@ -20,7 +20,7 @@ pub struct PublicKeyInfo { pub addresses: address::Addresses, } -impl ::GetInfo for PublicKey { +impl GetInfo for PublicKey { fn get_info(&self, network: Network) -> PublicKeyInfo { PublicKeyInfo { public_key: { @@ -40,7 +40,7 @@ impl ::GetInfo for PublicKey { #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct SignatureInfo { - pub der: ::HexBytes, - pub compact: ::HexBytes, + pub der: HexBytes, + pub compact: HexBytes, } diff --git a/src/lightning.rs b/src/lightning.rs index 87a4f73..030c26f 100644 --- a/src/lightning.rs +++ b/src/lightning.rs @@ -1,3 +1,5 @@ +use std::convert::TryFrom; + use bitcoin::hashes::{sha256, Hash}; use bitcoin::util::address::{Payload, WitnessVersion}; use bitcoin::{Address, Network}; @@ -5,7 +7,8 @@ use byteorder::{BigEndian, ByteOrder}; use chrono::{offset::Local, DateTime, Duration}; use lightning_invoice::{Currency, Fallback, Invoice, InvoiceDescription, RouteHop}; use serde::{Deserialize, Serialize}; -use std::convert::TryFrom; + +use crate::{GetInfo, HexBytes}; const WRONG_CID: &'static str = "incorrect short channel ID HRF format"; @@ -37,16 +40,16 @@ pub fn fmt_short_channel_id(cid: u64) -> String { #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct RouteHopInfo { - pub pubkey: ::HexBytes, + pub pubkey: HexBytes, pub short_channel_id: u64, - pub short_channel_id_hex: ::HexBytes, + pub short_channel_id_hex: HexBytes, pub short_channel_id_hrf: String, pub fee_base_msat: u32, pub fee_proportional_millionths: u32, pub cltv_expiry_delta: u16, } -impl ::GetInfo for RouteHop { +impl GetInfo for RouteHop { fn get_info(&self, _network: Network) -> RouteHopInfo { let ssid_hex = &self.short_channel_id[..]; let ssid = BigEndian::read_u64(&ssid_hex); @@ -68,7 +71,7 @@ pub struct InvoiceInfo { pub payment_hash: sha256::Hash, pub description: String, #[serde(skip_serializing_if = "Option::is_none")] - pub payee_pub_key: Option<::HexBytes>, + pub payee_pub_key: Option, #[serde(skip_serializing_if = "Option::is_none")] pub expiry_time: Option>, #[serde(skip_serializing_if = "Option::is_none")] @@ -82,12 +85,12 @@ pub struct InvoiceInfo { pub amount_pico_btc: Option, // For signed invoices. - pub signature: ::HexBytes, + pub signature: HexBytes, pub signature_recover_id: i32, - pub payee_pubkey: Option<::HexBytes>, + pub payee_pubkey: Option, } -impl ::GetInfo for Invoice { +impl GetInfo for Invoice { fn get_info(&self, network: Network) -> InvoiceInfo { let signed_raw = self.clone().into_signed_raw(); let (sig_rec, sig) = signed_raw.signature().0.serialize_compact(); @@ -133,7 +136,7 @@ impl ::GetInfo for Invoice { routes: self .routes() .iter() - .map(|r| r.iter().map(|h| ::GetInfo::get_info(h, network)).collect()) + .map(|r| r.iter().map(|h| GetInfo::get_info(h, network)).collect()) .collect(), currency: match self.currency() { Currency::Bitcoin => "bitcoin".to_owned(), diff --git a/src/miniscript.rs b/src/miniscript.rs index 3a95eba..f6e481c 100644 --- a/src/miniscript.rs +++ b/src/miniscript.rs @@ -1,5 +1,7 @@ use serde::{Deserialize, Serialize}; +use crate::HexBytes; + #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] pub enum MiniscriptKeyType { @@ -67,11 +69,11 @@ pub struct DescriptorInfo { #[serde(skip_serializing_if = "Option::is_none")] pub address: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub script_pubkey: Option<::HexBytes>, + pub script_pubkey: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub unsigned_script_sig: Option<::HexBytes>, + pub unsigned_script_sig: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub witness_script: Option<::HexBytes>, + pub witness_script: Option, #[serde(skip_serializing_if = "Option::is_none")] pub max_satisfaction_weight: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -96,7 +98,7 @@ pub struct MiniscriptInfo { #[serde(skip_serializing_if = "Option::is_none")] pub max_satisfaction_size_non_segwit: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub script: Option<::HexBytes>, + pub script: Option, #[serde(skip_serializing_if = "Option::is_none")] pub policy: Option, } diff --git a/src/psbt.rs b/src/psbt.rs index c250480..f0ca07e 100644 --- a/src/psbt.rs +++ b/src/psbt.rs @@ -4,6 +4,8 @@ use std::collections::HashMap; use bitcoin::util::{bip32, sighash, psbt}; use bitcoin::Network; +use crate::{tx, GetInfo, HexBytes}; + #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct HDPathInfo { pub master_fingerprint: bip32::Fingerprint, @@ -48,26 +50,26 @@ pub fn ecdsa_sighashtype_from_string(sht: &str) -> psbt::PsbtSighashType { #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct PsbtInputInfo { #[serde(skip_serializing_if = "Option::is_none")] - pub non_witness_utxo: Option<::tx::TransactionInfo>, + pub non_witness_utxo: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub witness_utxo: Option<::tx::OutputInfo>, + pub witness_utxo: Option, #[serde(skip_serializing_if = "HashMap::is_empty")] - pub partial_sigs: HashMap<::HexBytes, ::HexBytes>, + pub partial_sigs: HashMap, #[serde(skip_serializing_if = "Option::is_none")] pub sighash_type: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub redeem_script: Option<::tx::OutputScriptInfo>, + pub redeem_script: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub witness_script: Option<::tx::OutputScriptInfo>, + pub witness_script: Option, #[serde(skip_serializing_if = "HashMap::is_empty")] - pub hd_keypaths: HashMap<::HexBytes, HDPathInfo>, + pub hd_keypaths: HashMap, #[serde(skip_serializing_if = "Option::is_none")] - pub final_script_sig: Option<::tx::InputScriptInfo>, + pub final_script_sig: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub final_script_witness: Option>, + pub final_script_witness: Option>, } -impl ::GetInfo for psbt::Input { +impl GetInfo for psbt::Input { fn get_info(&self, network: Network) -> PsbtInputInfo { PsbtInputInfo { non_witness_utxo: self.non_witness_utxo.as_ref().map(|u| u.get_info(network)), @@ -81,9 +83,9 @@ impl ::GetInfo for psbt::Input { }, sighash_type: self.sighash_type.map(sighashtype_to_string), redeem_script: self.redeem_script.as_ref() - .map(|s| ::tx::OutputScript(s).get_info(network)), + .map(|s| tx::OutputScript(s).get_info(network)), witness_script: self.witness_script.as_ref() - .map(|s| ::tx::OutputScript(s).get_info(network)), + .map(|s| tx::OutputScript(s).get_info(network)), hd_keypaths: { let mut hd_keypaths = HashMap::new(); for (key, value) in self.bip32_derivation.iter() { @@ -97,7 +99,7 @@ impl ::GetInfo for psbt::Input { hd_keypaths }, final_script_sig: self.final_script_sig.as_ref() - .map(|s| ::tx::InputScript(s).get_info(network)), + .map(|s| tx::InputScript(s).get_info(network)), final_script_witness: self.final_script_witness.as_ref() .map(|w| w.iter().map(|p| p.clone().into()).collect()), } @@ -107,20 +109,20 @@ impl ::GetInfo for psbt::Input { #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct PsbtOutputInfo { #[serde(skip_serializing_if = "Option::is_none")] - pub redeem_script: Option<::tx::OutputScriptInfo>, + pub redeem_script: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub witness_script: Option<::tx::OutputScriptInfo>, + pub witness_script: Option, #[serde(skip_serializing_if = "HashMap::is_empty")] - pub hd_keypaths: HashMap<::HexBytes, HDPathInfo>, + pub hd_keypaths: HashMap, } -impl ::GetInfo for psbt::Output { +impl GetInfo for psbt::Output { fn get_info(&self, network: Network) -> PsbtOutputInfo { PsbtOutputInfo { redeem_script: self.redeem_script.as_ref() - .map(|s| ::tx::OutputScript(s).get_info(network)), + .map(|s| tx::OutputScript(s).get_info(network)), witness_script: self.witness_script.as_ref() - .map(|s| ::tx::OutputScript(s).get_info(network)), + .map(|s| tx::OutputScript(s).get_info(network)), hd_keypaths: { let mut hd_keypaths = HashMap::new(); for (key, value) in self.bip32_derivation.iter() { @@ -139,12 +141,12 @@ impl ::GetInfo for psbt::Output { #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct PsbtInfo { - pub unsigned_tx: ::tx::TransactionInfo, + pub unsigned_tx: tx::TransactionInfo, pub inputs: Vec, pub outputs: Vec, } -impl ::GetInfo for psbt::PartiallySignedTransaction { +impl GetInfo for psbt::PartiallySignedTransaction { fn get_info(&self, network: Network) -> PsbtInfo { PsbtInfo { unsigned_tx: self.unsigned_tx.get_info(network), diff --git a/src/tx.rs b/src/tx.rs index adc9730..633a36a 100644 --- a/src/tx.rs +++ b/src/tx.rs @@ -2,15 +2,17 @@ use bitcoin::consensus::encode::serialize; use bitcoin::{Address, Network, Script, Transaction, TxIn, TxOut, Txid, Wtxid}; use serde::{Deserialize, Serialize}; +use crate::{GetInfo, HexBytes}; + #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct InputScriptInfo { - pub hex: Option<::HexBytes>, + pub hex: Option, pub asm: Option, } pub struct InputScript<'a>(pub &'a Script); -impl<'a> ::GetInfo for InputScript<'a> { +impl<'a> GetInfo for InputScript<'a> { fn get_info(&self, _network: Network) -> InputScriptInfo { InputScriptInfo { hex: Some(self.0.to_bytes().into()), @@ -26,10 +28,10 @@ pub struct InputInfo { pub vout: Option, pub script_sig: Option, pub sequence: Option, - pub witness: Option>, + pub witness: Option>, } -impl ::GetInfo for TxIn { +impl GetInfo for TxIn { fn get_info(&self, network: Network) -> InputInfo { InputInfo { prevout: Some(self.previous_output.to_string()), @@ -48,7 +50,7 @@ impl ::GetInfo for TxIn { #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] pub struct OutputScriptInfo { - pub hex: Option<::HexBytes>, + pub hex: Option, pub asm: Option, #[serde(skip_serializing_if = "Option::is_none", rename = "type")] pub type_: Option, @@ -58,7 +60,7 @@ pub struct OutputScriptInfo { pub struct OutputScript<'a>(pub &'a Script); -impl<'a> ::GetInfo for OutputScript<'a> { +impl<'a> GetInfo for OutputScript<'a> { fn get_info(&self, network: Network) -> OutputScriptInfo { OutputScriptInfo { hex: Some(self.0.to_bytes().into()), @@ -92,7 +94,7 @@ pub struct OutputInfo { pub script_pub_key: Option, } -impl ::GetInfo for TxOut { +impl GetInfo for TxOut { fn get_info(&self, network: Network) -> OutputInfo { OutputInfo { value: Some(self.value), @@ -115,7 +117,7 @@ pub struct TransactionInfo { pub total_output_value: Option, } -impl ::GetInfo for Transaction { +impl GetInfo for Transaction { fn get_info(&self, network: Network) -> TransactionInfo { let weight = self.weight() as usize; TransactionInfo { From 29f63f417b55206bd0f60231607633468f8980a1 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sun, 12 Mar 2023 20:39:00 +0000 Subject: [PATCH 4/5] Document MSRV of 1.41.1 in README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index adb1e62..6ccbabe 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,11 @@ $ cargo install --locked hal - decode: decode a binary transaction to JSON +## Minimum Supported Rust Version (MSRV) + +`hal` should always compile on **Rust 1.41.1**. +Note that it should be build using the `Cargo.lock` file, so using `--locked`. + # Extensions hal allows the use of extensions that can be installed separately. From 9196e2be82da76726dd84b57155593f866d18717 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Mar 2023 16:53:57 +0000 Subject: [PATCH 5/5] Release v0.9.0 --- CHANGELOG.md | 8 ++++++++ Cargo.lock | 4 +++- Cargo.toml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80deb54..80dd1e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +# v0.9.0 -- 2023/03/23 + +- Enable 2018 edition +- Set MSRV at 1.41.1 +- Bump bitcoin dependency to v0.29.2 +- Bump secp256k1 dependency to v0.24.3 +- Bump miniscript dependency to v9.0.1 + # v0.8.2 -- 2022/06/27 - Add a `descriptor` field to `DescriptorInfo` diff --git a/Cargo.lock b/Cargo.lock index d78d855..12885ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ansi_term" version = "0.11.0" @@ -163,7 +165,7 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "hal" -version = "0.8.2" +version = "0.9.0" dependencies = [ "base64-compat", "bip39", diff --git a/Cargo.toml b/Cargo.toml index 2844740..f0aa656 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hal" -version = "0.8.2" +version = "0.9.0" authors = ["Steven Roose "] license = "CC0-1.0" homepage = "https://github.com/stevenroose/hal/"