From a79f6f06bf4e9b7b1b90186c9b9c9645ef46e783 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Fri, 22 Nov 2024 16:31:06 -0500 Subject: [PATCH] Drop unnecessary `vec!` allocations in RPC calls --- src/chain/bitcoind_rpc.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/chain/bitcoind_rpc.rs b/src/chain/bitcoind_rpc.rs index 871dd8a42..336c296ec 100644 --- a/src/chain/bitcoind_rpc.rs +++ b/src/chain/bitcoind_rpc.rs @@ -51,7 +51,7 @@ impl BitcoindRpcClient { pub(crate) async fn broadcast_transaction(&self, tx: &Transaction) -> std::io::Result { let tx_serialized = bitcoin::consensus::encode::serialize_hex(tx); let tx_json = serde_json::json!(tx_serialized); - self.rpc_client.call_method::("sendrawtransaction", &vec![tx_json]).await + self.rpc_client.call_method::("sendrawtransaction", &[tx_json]).await } pub(crate) async fn get_fee_estimate_for_target( @@ -62,7 +62,7 @@ impl BitcoindRpcClient { self.rpc_client .call_method::( "estimatesmartfee", - &vec![num_blocks_json, estimation_mode_json], + &[num_blocks_json, estimation_mode_json], ) .await .map(|resp| resp.0) @@ -70,7 +70,7 @@ impl BitcoindRpcClient { pub(crate) async fn get_mempool_minimum_fee_rate(&self) -> std::io::Result { self.rpc_client - .call_method::("getmempoolinfo", &vec![]) + .call_method::("getmempoolinfo", &[]) .await .map(|resp| resp.0) } @@ -82,7 +82,7 @@ impl BitcoindRpcClient { let txid_json = serde_json::json!(txid_hex); match self .rpc_client - .call_method::("getrawtransaction", &vec![txid_json]) + .call_method::("getrawtransaction", &[txid_json]) .await { Ok(resp) => Ok(Some(resp.0)), @@ -116,7 +116,7 @@ impl BitcoindRpcClient { pub(crate) async fn get_raw_mempool(&self) -> std::io::Result> { let verbose_flag_json = serde_json::json!(false); self.rpc_client - .call_method::("getrawmempool", &vec![verbose_flag_json]) + .call_method::("getrawmempool", &[verbose_flag_json]) .await .map(|resp| resp.0) } @@ -125,7 +125,7 @@ impl BitcoindRpcClient { let txid_hex = bitcoin::consensus::encode::serialize_hex(&txid); let txid_json = serde_json::json!(txid_hex); self.rpc_client - .call_method::("getmempoolentry", &vec![txid_json]) + .call_method::("getmempoolentry", &[txid_json]) .await .map(|resp| MempoolEntry { txid, height: resp.height, time: resp.time }) }