]> Untitled Git - bdk-cli/commitdiff
Derive Eq on enums and struts where possible
authorrajarshimaitra <rajarshi149@gmail.com>
Wed, 18 Jan 2023 05:32:17 +0000 (11:02 +0530)
committerSteve Myers <steve@notmandatory.org>
Tue, 14 Feb 2023 21:50:12 +0000 (15:50 -0600)
src/commands.rs
src/handlers.rs

index 6bc59996aa84f9544910b79efc87ff73bacb1428..6b64c87f9f9062a86961680e2ff618ee98fd2344 100644 (file)
@@ -144,7 +144,7 @@ pub enum CliSubCommand {
 }
 
 /// Backend Node operation subcommands.
-#[derive(Debug, Subcommand, Clone, PartialEq)]
+#[derive(Debug, Subcommand, Clone, PartialEq, Eq)]
 #[clap(rename_all = "lower")]
 #[cfg(any(feature = "regtest-node"))]
 pub enum NodeSubCommand {
@@ -179,7 +179,7 @@ pub enum WalletSubCommand {
 }
 
 /// Config options wallet operations can take.
-#[derive(Debug, Parser, Clone, PartialEq)]
+#[derive(Debug, Parser, Clone, PartialEq, Eq)]
 pub struct WalletOpts {
     /// Selects the wallet to use.
     #[clap(name = "WALLET_NAME", short = 'w', long = "wallet")]
@@ -212,7 +212,7 @@ pub struct WalletOpts {
 
 /// Options to configure a SOCKS5 proxy for a blockchain client connection.
 #[cfg(any(feature = "compact_filters", feature = "electrum", feature = "esplora"))]
-#[derive(Debug, Args, Clone, PartialEq)]
+#[derive(Debug, Args, Clone, PartialEq, Eq)]
 pub struct ProxyOpts {
     /// Sets the SOCKS5 proxy for a blockchain client.
     #[clap(name = "PROXY_ADDRS:PORT", long = "proxy", short = 'p')]
@@ -234,7 +234,7 @@ pub struct ProxyOpts {
 
 /// Options to configure a BIP157 Compact Filter backend.
 #[cfg(feature = "compact_filters")]
-#[derive(Debug, Args, Clone, PartialEq)]
+#[derive(Debug, Args, Clone, PartialEq, Eq)]
 pub struct CompactFilterOpts {
     /// Sets the full node network address.
     #[clap(
@@ -261,7 +261,7 @@ pub struct CompactFilterOpts {
 
 /// Options to configure a bitcoin core rpc backend.
 #[cfg(feature = "rpc")]
-#[derive(Debug, Args, Clone, PartialEq)]
+#[derive(Debug, Args, Clone, PartialEq, Eq)]
 pub struct RpcOpts {
     /// Sets the full node address for rpc connection.
     #[clap(
@@ -298,7 +298,7 @@ pub struct RpcOpts {
 
 /// Options to configure electrum backend.
 #[cfg(feature = "electrum")]
-#[derive(Debug, Args, Clone, PartialEq)]
+#[derive(Debug, Args, Clone, PartialEq, Eq)]
 pub struct ElectrumOpts {
     /// Sets the SOCKS5 proxy timeout for the Electrum client.
     #[clap(name = "PROXY_TIMEOUT", short = 't', long = "timeout")]
@@ -324,7 +324,7 @@ pub struct ElectrumOpts {
 
 /// Options to configure Esplora backend.
 #[cfg(feature = "esplora")]
-#[derive(Debug, Args, Clone, PartialEq)]
+#[derive(Debug, Args, Clone, PartialEq, Eq)]
 pub struct EsploraOpts {
     /// Use the esplora server if given as parameter.
     #[clap(
@@ -477,7 +477,7 @@ pub enum OfflineWalletSubCommand {
 }
 
 /// Wallet subcommands that needs a blockchain backend.
-#[derive(Debug, Subcommand, Clone, PartialEq)]
+#[derive(Debug, Subcommand, Clone, PartialEq, Eq)]
 #[clap(rename_all = "snake")]
 #[cfg(any(
     feature = "electrum",
@@ -530,7 +530,7 @@ pub enum OnlineWalletSubCommand {
 }
 
 /// Subcommands for Key operations.
-#[derive(Debug, Subcommand, Clone, PartialEq)]
+#[derive(Debug, Subcommand, Clone, PartialEq, Eq)]
 pub enum KeySubCommand {
     /// Generates new random seed mnemonic phrase and corresponding master extended key.
     Generate {
index ca3523129f023578d834ef57f3cccb1656e661fe..36c31a2f3a6d0cfc175bf78502628664b6c06096 100644 (file)
@@ -747,18 +747,18 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
     result.map_err(|e| e.into())
 }
 
+#[cfg(any(
+    feature = "electrum",
+    feature = "esplora",
+    feature = "compact_filters",
+    feature = "rpc"
+))]
 #[cfg(test)]
 mod test {
     use super::*;
     use bdk::bitcoin::psbt::PartiallySignedTransaction;
     use std::str::FromStr;
 
-    #[cfg(any(
-        feature = "electrum",
-        feature = "esplora",
-        feature = "compact_filters",
-        feature = "rpc"
-    ))]
     #[test]
     fn test_psbt_is_final() {
         let unsigned_psbt = PartiallySignedTransaction::from_str("cHNidP8BAIkBAAAAASWJHzxzyVORV/C3lAynKHVVL7+Rw7/Jj8U9fuvD24olAAAAAAD+////AiBOAAAAAAAAIgAgLzY9yE4jzTFJnHtTjkc+rFAtJ9NB7ENFQ1xLYoKsI1cfqgKVAAAAACIAIFsbWgDeLGU8EA+RGwBDIbcv4gaGG0tbEIhDvwXXa/E7LwEAAAABALUCAAAAAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////BALLAAD/////AgD5ApUAAAAAIgAgWxtaAN4sZTwQD5EbAEMhty/iBoYbS1sQiEO/Bddr8TsAAAAAAAAAACZqJKohqe3i9hw/cdHe/T+pmd+jaVN1XGkGiXmZYrSL69g2l06M+QEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQErAPkClQAAAAAiACBbG1oA3ixlPBAPkRsAQyG3L+IGhhtLWxCIQ78F12vxOwEFR1IhA/JV2U/0pXW+iP49QcsYilEvkZEd4phmDM8nV8wC+MeDIQLKhV/gEZYmlsQXnsL5/Uqv5Y8O31tmWW1LQqIBkiqzCVKuIgYCyoVf4BGWJpbEF57C+f1Kr+WPDt9bZlltS0KiAZIqswkEboH3lCIGA/JV2U/0pXW+iP49QcsYilEvkZEd4phmDM8nV8wC+MeDBDS6ZSEAACICAsqFX+ARliaWxBeewvn9Sq/ljw7fW2ZZbUtCogGSKrMJBG6B95QiAgPyVdlP9KV1voj+PUHLGIpRL5GRHeKYZgzPJ1fMAvjHgwQ0umUhAA==").unwrap();