diff --git a/rpc-client/src/client.rs b/rpc-client/src/client.rs index 12b385c5f..8614d6a28 100644 --- a/rpc-client/src/client.rs +++ b/rpc-client/src/client.rs @@ -114,7 +114,7 @@ fn empty_obj() -> Value { /// /// Elements of `args` without corresponding `defaults` value, won't /// be substituted, because they are required. -fn handle_defaults<'a, 'b>(args: &'a mut [Value], defaults: &'b [Value]) -> &'a [Value] { +fn handle_defaults<'a>(args: &'a mut [Value], defaults: &[Value]) -> &'a [Value] { assert!(args.len() >= defaults.len()); // Pass over the optional arguments in backwards order, filling in defaults after the first @@ -158,25 +158,25 @@ pub trait RawTx: Sized + Clone { fn raw_hex(self) -> String; } -impl<'a> RawTx for &'a Transaction { +impl RawTx for &Transaction { fn raw_hex(self) -> String { hex::encode(consensus::encode::serialize(&self)) } } -impl<'a> RawTx for &'a [u8] { +impl RawTx for &[u8] { fn raw_hex(self) -> String { self.to_lower_hex_string() } } -impl<'a> RawTx for &'a Vec { +impl RawTx for &Vec { fn raw_hex(self) -> String { self.to_lower_hex_string() } } -impl<'a> RawTx for &'a str { +impl RawTx for &str { fn raw_hex(self) -> String { self.to_owned() } @@ -226,7 +226,7 @@ pub trait RpcApi: Sized { &self, id: &>::Id, ) -> Result { - T::query(&self, &id) + T::query(self, id) } fn get_network_info(&self) -> Result { @@ -324,7 +324,7 @@ pub trait RpcApi: Sized { } fn get_block_json(&self, hash: &BlockHash) -> Result { - Ok(self.call::("getblock", &[into_json(hash)?, 1.into()])?) + self.call::("getblock", &[into_json(hash)?, 1.into()]) } fn get_block_hex(&self, hash: &BlockHash) -> Result { @@ -366,9 +366,9 @@ pub trait RpcApi: Sized { self.call( "getblocktemplate", &[into_json(Argument { - mode: mode, - rules: rules, - capabilities: capabilities, + mode, + rules, + capabilities, })?], ) } @@ -498,7 +498,7 @@ pub trait RpcApi: Sized { } fn get_balances(&self) -> Result { - Ok(self.call("getbalances", &[])?) + self.call("getbalances", &[]) } fn get_received_by_address(&self, address: &Address, minconf: Option) -> Result { @@ -510,12 +510,9 @@ pub trait RpcApi: Sized { fn get_transaction_are_locked( &self, - tx_ids: &Vec, + tx_ids: &[dashcore::Txid], ) -> Result>> { - let transaction_ids_json = tx_ids - .into_iter() - .map(|tx_id| Ok(into_json(tx_id)?)) - .collect::>>()?; + let transaction_ids_json = tx_ids.iter().map(into_json).collect::>>()?; let args = [transaction_ids_json.into()]; self.call("gettxchainlocks", &args) } @@ -527,8 +524,8 @@ pub trait RpcApi: Sized { height: Option, ) -> Result> { let indices_json = indices - .into_iter() - .map(|index| Ok(into_json(index.to_string())?)) + .iter() + .map(|index| into_json(index.to_string())) .collect::>>()?; let args = [indices_json.into(), opt_into_json(height)?]; self.call("getassetunlockstatuses", &args) @@ -678,18 +675,14 @@ pub trait RpcApi: Sized { /// To unlock, use [unlock_unspent]. fn lock_unspent(&self, outputs: &[OutPoint]) -> Result { - let outputs: Vec<_> = outputs - .into_iter() - .map(|o| serde_json::to_value(JsonOutPoint::from(*o)).unwrap()) - .collect(); + let outputs: Vec<_> = + outputs.iter().map(|o| serde_json::to_value(JsonOutPoint::from(*o)).unwrap()).collect(); self.call("lockunspent", &[false.into(), outputs.into()]) } fn unlock_unspent(&self, outputs: &[OutPoint]) -> Result { - let outputs: Vec<_> = outputs - .into_iter() - .map(|o| serde_json::to_value(JsonOutPoint::from(*o)).unwrap()) - .collect(); + let outputs: Vec<_> = + outputs.iter().map(|o| serde_json::to_value(JsonOutPoint::from(*o)).unwrap()).collect(); self.call("lockunspent", &[true.into(), outputs.into()]) } @@ -784,7 +777,7 @@ pub trait RpcApi: Sized { &self, rawtxs: &[R], ) -> Result> { - let hexes: Vec = rawtxs.to_vec().into_iter().map(|r| r.raw_hex().into()).collect(); + let hexes: Vec = rawtxs.iter().cloned().map(|r| r.raw_hex().into()).collect(); self.call("testmempoolaccept", &[hexes.into()]) } @@ -897,22 +890,22 @@ pub trait RpcApi: Sized { /// Attempts to add a node to the addnode list. /// Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be full nodes/support SegWit as other outbound peers are (though such peers will not be synced from). fn add_node(&self, addr: &str) -> Result<()> { - self.call("addnode", &[into_json(&addr)?, into_json("add")?]) + self.call("addnode", &[into_json(addr)?, into_json("add")?]) } /// Attempts to remove a node from the addnode list. fn remove_node(&self, addr: &str) -> Result<()> { - self.call("addnode", &[into_json(&addr)?, into_json("remove")?]) + self.call("addnode", &[into_json(addr)?, into_json("remove")?]) } /// Attempts to connect to a node without permanently adding it to the addnode list. fn onetry_node(&self, addr: &str) -> Result<()> { - self.call("addnode", &[into_json(&addr)?, into_json("onetry")?]) + self.call("addnode", &[into_json(addr)?, into_json("onetry")?]) } /// Immediately disconnects from the specified peer node. fn disconnect_node(&self, addr: &str) -> Result<()> { - self.call("disconnectnode", &[into_json(&addr)?]) + self.call("disconnectnode", &[into_json(addr)?]) } fn disconnect_node_by_id(&self, node_id: u32) -> Result<()> { @@ -922,7 +915,7 @@ pub trait RpcApi: Sized { /// Returns information about the given added node, or all added nodes (note that onetry addnodes are not listed here) fn get_added_node_info(&self, node: Option<&str>) -> Result> { if let Some(addr) = node { - self.call("getaddednodeinfo", &[into_json(&addr)?]) + self.call("getaddednodeinfo", &[into_json(addr)?]) } else { self.call("getaddednodeinfo", &[]) } @@ -934,7 +927,7 @@ pub trait RpcApi: Sized { count: Option, ) -> Result> { let cnt = count.unwrap_or(1); - self.call("getnodeaddresses", &[into_json(&cnt)?]) + self.call("getnodeaddresses", &[into_json(cnt)?]) } /// List all banned IPs/Subnets. @@ -951,18 +944,18 @@ pub trait RpcApi: Sized { fn add_ban(&self, subnet: &str, bantime: u64, absolute: bool) -> Result<()> { self.call( "setban", - &[into_json(&subnet)?, into_json("add")?, into_json(&bantime)?, into_json(&absolute)?], + &[into_json(subnet)?, into_json("add")?, into_json(bantime)?, into_json(absolute)?], ) } /// Attempts to remove an IP/Subnet from the banned list. fn remove_ban(&self, subnet: &str) -> Result<()> { - self.call("setban", &[into_json(&subnet)?, into_json("remove")?]) + self.call("setban", &[into_json(subnet)?, into_json("remove")?]) } /// Disable/enable all p2p network activity. fn set_network_active(&self, state: bool) -> Result { - self.call("setnetworkactive", &[into_json(&state)?]) + self.call("setnetworkactive", &[into_json(state)?]) } /// Returns data about each connected network node as an array of @@ -1698,7 +1691,7 @@ impl RpcApi for Client { fn call serde::de::Deserialize<'a>>(&self, cmd: &str, args: &[Value]) -> Result { let raw_args_json = serde_json::to_string(args)?; let raw_args = Some(serde_json::value::RawValue::from_string(raw_args_json)?); - let req = self.client.build_request(&cmd, raw_args.as_deref()); + let req = self.client.build_request(cmd, raw_args.as_deref()); if log_enabled!(Debug) { debug!(target: "dashcore_rpc", "JSON-RPC request: {} {}", cmd, serde_json::Value::from(args)); } @@ -1744,7 +1737,7 @@ mod tests { #[test] fn test_raw_tx() { use dashcore::consensus::encode; - let client = Client::new("http://localhost/".into(), Auth::None).unwrap(); + let client = Client::new("http://localhost/", Auth::None).unwrap(); let tx: Transaction = encode::deserialize(&Vec::::from_hex("0200000001586bd02815cf5faabfec986a4e50d25dbee089bd2758621e61c5fab06c334af0000000006b483045022100e85425f6d7c589972ee061413bcf08dc8c8e589ce37b217535a42af924f0e4d602205c9ba9cb14ef15513c9d946fa1c4b797883e748e8c32171bdf6166583946e35c012103dae30a4d7870cd87b45dd53e6012f71318fdd059c1c2623b8cc73f8af287bb2dfeffffff021dc4260c010000001976a914f602e88b2b5901d8aab15ebe4a97cf92ec6e03b388ac00e1f505000000001976a914687ffeffe8cf4e4c038da46a9b1d37db385a472d88acfd211500").unwrap()).unwrap(); assert!(client.send_raw_transaction(&tx).is_err()); diff --git a/rpc-integration-test/src/main.rs b/rpc-integration-test/src/main.rs index a7120f660..707aad2c0 100644 --- a/rpc-integration-test/src/main.rs +++ b/rpc-integration-test/src/main.rs @@ -16,11 +16,12 @@ use log::{Log, trace}; use std::collections::{HashMap, HashSet}; use std::str::FromStr; +use dashcore_rpc::json; use dashcore_rpc::jsonrpc::error::Error as JsonRpcError; use dashcore_rpc::{ Auth, Client, Error, RpcApi, dashcore::{ - Address, AddressType, Amount, EcdsaSighashType, Network, OutPoint, PrivateKey, Script, + Address, AddressType, Amount, EcdsaSighashType, Network, OutPoint, PrivateKey, SignedAmount, Transaction, TxIn, TxOut, Txid, Witness, consensus::encode::{deserialize, serialize}, hashes::Hash, @@ -28,7 +29,6 @@ use dashcore_rpc::{ secp256k1, }, }; -use dashcore_rpc::{RawTx, json}; use dashcore_rpc::dashcore::address::NetworkUnchecked; use dashcore_rpc::dashcore::{BlockHash, ProTxHash, QuorumHash, ScriptBuf}; @@ -38,7 +38,6 @@ use dashcore_rpc::dashcore_rpc_json::{ }; use dashcore_rpc::json::ProTxListType; use dashcore_rpc::json::QuorumType::LlmqTest; -use json::BlockStatsFields as BsFields; lazy_static! { static ref SECP: secp256k1::Secp256k1 = secp256k1::Secp256k1::new(); @@ -202,10 +201,9 @@ fn main() { trace!(target: "integration_test", "Evo node RPC URL: {}", &evo_node_rpc_url); trace!(target: "integration_test", "Evo node RPC Auth: {:?}", evo_node_auth_type); - let faucet_rpc_url = - format!("{}/wallet/{}", wallet_node_rpc_url, FAUCET_WALLET_NAME.to_string()); - let wallet_rpc_url = format!("{}/wallet/{}", wallet_node_rpc_url, TEST_WALLET_NAME.to_string()); - let evo_rpc_url = format!("{}/wallet/{}", evo_node_rpc_url, TEST_WALLET_NAME.to_string()); + let faucet_rpc_url = format!("{}/wallet/{}", wallet_node_rpc_url, FAUCET_WALLET_NAME); + let wallet_rpc_url = format!("{}/wallet/{}", wallet_node_rpc_url, TEST_WALLET_NAME); + let evo_rpc_url = format!("{}/wallet/{}", evo_node_rpc_url, TEST_WALLET_NAME); let faucet_client = Client::new(&faucet_rpc_url, wallet_node_auth.clone().clone()).unwrap(); let wallet_client = Client::new(&wallet_rpc_url, wallet_node_auth).unwrap(); @@ -226,17 +224,17 @@ fn main() { Err(e) => match e { dashcore_rpc::Error::JsonRpc(JsonRpcError::Rpc(ref e)) if e.code == -18 => { wallet_client.create_wallet(&TEST_WALLET_NAME, None, None, None, None).unwrap(); - trace!(target: "integration_test", "Wallet \"{}\" created", TEST_WALLET_NAME.to_string()); + trace!(target: "integration_test", "Wallet \"{}\" created", TEST_WALLET_NAME); } dashcore_rpc::Error::JsonRpc(JsonRpcError::Rpc(ref e)) if e.code == -35 => { - trace!(target: "integration_test", "Wallet \"{}\" already loaded", TEST_WALLET_NAME.to_string()); + trace!(target: "integration_test", "Wallet \"{}\" already loaded", TEST_WALLET_NAME); } _ => { panic!("Error loading wallet: {:?}", e); } }, Ok(_) => { - trace!(target: "integration_test", "Loaded wallet \"{}\"", TEST_WALLET_NAME.to_string()); + trace!(target: "integration_test", "Loaded wallet \"{}\"", TEST_WALLET_NAME); } } @@ -260,13 +258,11 @@ fn main() { .unwrap(); let balance = wallet_client.get_balance(None, None).unwrap(); - trace!(target: "integration_test", "Funded wallet \"{}\". Total balance: {}", TEST_WALLET_NAME.to_string(), balance); + trace!(target: "integration_test", "Funded wallet \"{}\". Total balance: {}", TEST_WALLET_NAME, balance); faucet_client.generate_to_address(8, &test_wallet_address).unwrap(); test_wallet_node_endpoints(&wallet_client); test_evo_node_endpoints(&evo_client, &wallet_client); - return; - // //TODO import_multi( // //TODO verify_message( // //TODO wait_for_new_block(&self, timeout: u64) -> Result { @@ -410,7 +406,7 @@ fn test_evo_node_endpoints(evo_client: &Client, wallet_client: &Client) { // TODO: fix - needs real hash // test_get_verifyislock(evo_client); - test_get_asset_unlock_statuses(&evo_client); + test_get_asset_unlock_statuses(evo_client); } fn test_get_network_info(cl: &Client) { @@ -703,7 +699,7 @@ fn test_get_tx_out_proof(cl: &Client) { .send_to_address(&RANDOM_ADDRESS, btc(1), None, None, None, None, None, None, None, None) .unwrap(); let addr = &cl.get_new_address(None).unwrap().require_network(*NET).unwrap(); - let blocks = cl.generate_to_address(7, &addr).unwrap(); + let blocks = cl.generate_to_address(7, addr).unwrap(); let proof = cl.get_tx_out_proof(&[txid1, txid2], Some(&blocks[0])).unwrap(); assert!(!proof.is_empty()); } @@ -733,7 +729,7 @@ fn test_lock_unspent_unlock_unspent(cl: &Client) { fn test_get_block_filter(cl: &Client) { let addr = &cl.get_new_address(None).unwrap().require_network(*NET).unwrap(); - let blocks = cl.generate_to_address(7, &addr).unwrap(); + let blocks = cl.generate_to_address(7, addr).unwrap(); if wallet_node_version() >= 190000 { let _ = cl.get_block_filter(&blocks[0]).unwrap(); } else { @@ -754,7 +750,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) { ..Default::default() }; let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap(); - let unspent = unspent.into_iter().nth(0).unwrap(); + let unspent = unspent.into_iter().next().unwrap(); let tx = Transaction { version: 1, @@ -791,7 +787,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) { lock_time: 0, input: vec![TxIn { previous_output: OutPoint { - txid: txid, + txid, vout: 0, }, script_sig: ScriptBuf::new(), @@ -829,7 +825,7 @@ fn test_create_raw_transaction(cl: &Client) { ..Default::default() }; let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap(); - let unspent = unspent.into_iter().nth(0).unwrap(); + let unspent = unspent.into_iter().next().unwrap(); let input = json::CreateRawTransactionInput { txid: unspent.txid, @@ -839,7 +835,8 @@ fn test_create_raw_transaction(cl: &Client) { let mut output = HashMap::new(); output.insert(RANDOM_ADDRESS.to_string(), btc(1)); - let tx = cl.create_raw_transaction(&[input.clone()], &output, Some(500_000)).unwrap(); + let tx = + cl.create_raw_transaction(std::slice::from_ref(&input), &output, Some(500_000)).unwrap(); let hex = cl.create_raw_transaction_hex(&[input], &output, Some(500_000)).unwrap(); assert_eq!(tx, deserialize(&hex::decode(&hex).unwrap()).unwrap()); assert_eq!(hex, hex::encode(serialize(&tx))); @@ -881,7 +878,7 @@ fn test_test_mempool_accept(cl: &Client) { ..Default::default() }; let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap(); - let unspent = unspent.into_iter().nth(0).unwrap(); + let unspent = unspent.into_iter().next().unwrap(); let input = json::CreateRawTransactionInput { txid: unspent.txid, @@ -891,7 +888,8 @@ fn test_test_mempool_accept(cl: &Client) { let mut output = HashMap::new(); output.insert(RANDOM_ADDRESS.to_string(), unspent.amount - *FEE); - let tx = cl.create_raw_transaction(&[input.clone()], &output, Some(500_000)).unwrap(); + let tx = + cl.create_raw_transaction(std::slice::from_ref(&input), &output, Some(500_000)).unwrap(); let res = cl.test_mempool_accept(&[&tx]).unwrap(); assert!(!res[0].allowed); // assert!(res[0].reject_reason.is_some()); @@ -908,7 +906,7 @@ fn test_wallet_create_funded_psbt(cl: &Client) { ..Default::default() }; let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap(); - let unspent = unspent.into_iter().nth(0).unwrap(); + let unspent = unspent.into_iter().next().unwrap(); let input = json::CreateRawTransactionInput { txid: unspent.txid, @@ -931,7 +929,7 @@ fn test_wallet_create_funded_psbt(cl: &Client) { }; let _ = cl .wallet_create_funded_psbt( - &[input.clone()], + std::slice::from_ref(&input), &output, Some(500_000), Some(options), @@ -962,7 +960,7 @@ fn test_wallet_process_psbt(cl: &Client) { ..Default::default() }; let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap(); - let unspent = unspent.into_iter().nth(0).unwrap(); + let unspent = unspent.into_iter().next().unwrap(); let input = json::CreateRawTransactionInput { txid: unspent.txid, vout: unspent.vout, @@ -971,7 +969,13 @@ fn test_wallet_process_psbt(cl: &Client) { let mut output = HashMap::new(); output.insert(RANDOM_ADDRESS.to_string(), btc(1)); let psbt = cl - .wallet_create_funded_psbt(&[input.clone()], &output, Some(500_000), None, Some(true)) + .wallet_create_funded_psbt( + std::slice::from_ref(&input), + &output, + Some(500_000), + None, + Some(true), + ) .unwrap(); let res = cl.wallet_process_psbt(&psbt.psbt, Some(true), None, Some(true)).unwrap(); @@ -984,7 +988,7 @@ fn test_combine_psbt(cl: &Client) { ..Default::default() }; let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap(); - let unspent = unspent.into_iter().nth(0).unwrap(); + let unspent = unspent.into_iter().next().unwrap(); let input = json::CreateRawTransactionInput { txid: unspent.txid, vout: unspent.vout, @@ -993,7 +997,13 @@ fn test_combine_psbt(cl: &Client) { let mut output = HashMap::new(); output.insert(RANDOM_ADDRESS.to_string(), btc(1)); let psbt1 = cl - .wallet_create_funded_psbt(&[input.clone()], &output, Some(500_000), None, Some(true)) + .wallet_create_funded_psbt( + std::slice::from_ref(&input), + &output, + Some(500_000), + None, + Some(true), + ) .unwrap(); let psbt = cl.combine_psbt(&[psbt1.psbt.clone(), psbt1.psbt]).unwrap(); @@ -1006,7 +1016,7 @@ fn test_finalize_psbt(cl: &Client) { ..Default::default() }; let unspent = cl.list_unspent(Some(6), None, None, None, Some(options)).unwrap(); - let unspent = unspent.into_iter().nth(0).unwrap(); + let unspent = unspent.into_iter().next().unwrap(); let input = json::CreateRawTransactionInput { txid: unspent.txid, vout: unspent.vout, @@ -1015,7 +1025,13 @@ fn test_finalize_psbt(cl: &Client) { let mut output = HashMap::new(); output.insert(RANDOM_ADDRESS.to_string(), btc(1)); let psbt = cl - .wallet_create_funded_psbt(&[input.clone()], &output, Some(500_000), None, Some(true)) + .wallet_create_funded_psbt( + std::slice::from_ref(&input), + &output, + Some(500_000), + None, + Some(true), + ) .unwrap(); let res = cl.finalize_psbt(&psbt.psbt, Some(true)).unwrap(); @@ -1092,7 +1108,7 @@ fn test_estimate_smart_fee(cl: &Client) { // With a fresh node, we can't get fee estimates. if let Some(errors) = res.errors { - if errors == &["Insufficient data or no feerate found"] { + if errors == ["Insufficient data or no feerate found"] { println!("Cannot test estimate_smart_fee because no feerate found!"); return; } else { @@ -1105,7 +1121,7 @@ fn test_estimate_smart_fee(cl: &Client) { } fn test_ping(cl: &Client) { - let _ = cl.ping().unwrap(); + cl.ping().unwrap(); } fn test_get_peer_info(cl: &Client) { @@ -1175,8 +1191,7 @@ fn test_create_wallet(cl: &Client) { }); } - let existing_wallets = - cl.list_wallets().unwrap().into_iter().map(|w| w).collect::>(); + let existing_wallets = cl.list_wallets().unwrap().into_iter().collect::>(); for wallet_param in wallet_params { if !existing_wallets.contains(wallet_param.name) { @@ -1228,14 +1243,8 @@ fn test_create_wallet(cl: &Client) { wallet_list.sort(); // Main wallet created for tests - assert!( - wallet_list - .iter() - .any(|w| w == &TEST_WALLET_NAME.to_string() || w == &FAUCET_WALLET_NAME.to_string()) - ); - wallet_list.retain(|w| { - w != &TEST_WALLET_NAME.to_string() && w != "" && w != &FAUCET_WALLET_NAME.to_string() - }); + assert!(wallet_list.iter().any(|w| w == &TEST_WALLET_NAME || w == &FAUCET_WALLET_NAME)); + wallet_list.retain(|w| w != &TEST_WALLET_NAME && !w.is_empty() && w != &FAUCET_WALLET_NAME); // Created wallets assert!(wallet_list.iter().zip(wallet_names).all(|(a, b)| a == b)); @@ -1405,7 +1414,6 @@ fn test_get_quorum_info(cl: &Client) { let quorum_info = cl.get_quorum_info(quorum_type, &quorum_hash, None).unwrap(); assert!(quorum_info.height > 0); - assert!(quorum_info.members.len() >= 0); } fn test_get_quorum_dkgstatus(cl: &Client) { @@ -1525,23 +1533,18 @@ fn test_get_protx_info(cl: &Client) { .unwrap(); let protx_info = cl.get_protx_info(&pro_tx_hash, None).unwrap(); - match protx_info { - ProTxInfo { - pro_tx_hash: _, - collateral_hash: _, - collateral_index, - collateral_address: _, - operator_reward, - state: _, - confirmations: _, - wallet: _, - meta_info: _, - .. - } => { - // assert!(collateral_index >= 0); - // assert!(operator_reward >= 0); - } - } + let ProTxInfo { + pro_tx_hash: _, + collateral_hash: _, + collateral_index, + collateral_address: _, + operator_reward, + state: _, + confirmations: _, + wallet: _, + meta_info: _, + .. + } = protx_info; } fn test_get_protx_list(cl: &Client) { diff --git a/rpc-json/src/lib.rs b/rpc-json/src/lib.rs index 3c6184a91..d7f6228ed 100644 --- a/rpc-json/src/lib.rs +++ b/rpc-json/src/lib.rs @@ -1054,7 +1054,7 @@ impl<'a> serde::Serialize for ImportMultiRequestScriptPubkey<'a> { S: Serializer, { match *self { - ImportMultiRequestScriptPubkey::Address(ref addr) => { + ImportMultiRequestScriptPubkey::Address(addr) => { #[derive(Serialize)] struct Tmp<'a> { pub address: &'a Address,