Skip to content

Commit 002c402

Browse files
committed
Drop unnecessary vec! allocations in RPC calls
1 parent 727f685 commit 002c402

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/chain/bitcoind_rpc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl BitcoindRpcClient {
5151
pub(crate) async fn broadcast_transaction(&self, tx: &Transaction) -> std::io::Result<Txid> {
5252
let tx_serialized = bitcoin::consensus::encode::serialize_hex(tx);
5353
let tx_json = serde_json::json!(tx_serialized);
54-
self.rpc_client.call_method::<Txid>("sendrawtransaction", &vec![tx_json]).await
54+
self.rpc_client.call_method::<Txid>("sendrawtransaction", &[tx_json]).await
5555
}
5656

5757
pub(crate) async fn get_fee_estimate_for_target(
@@ -62,15 +62,15 @@ impl BitcoindRpcClient {
6262
self.rpc_client
6363
.call_method::<FeeResponse>(
6464
"estimatesmartfee",
65-
&vec![num_blocks_json, estimation_mode_json],
65+
&[num_blocks_json, estimation_mode_json],
6666
)
6767
.await
6868
.map(|resp| resp.0)
6969
}
7070

7171
pub(crate) async fn get_mempool_minimum_fee_rate(&self) -> std::io::Result<FeeRate> {
7272
self.rpc_client
73-
.call_method::<MempoolMinFeeResponse>("getmempoolinfo", &vec![])
73+
.call_method::<MempoolMinFeeResponse>("getmempoolinfo", &[])
7474
.await
7575
.map(|resp| resp.0)
7676
}
@@ -82,7 +82,7 @@ impl BitcoindRpcClient {
8282
let txid_json = serde_json::json!(txid_hex);
8383
match self
8484
.rpc_client
85-
.call_method::<GetRawTransactionResponse>("getrawtransaction", &vec![txid_json])
85+
.call_method::<GetRawTransactionResponse>("getrawtransaction", &[txid_json])
8686
.await
8787
{
8888
Ok(resp) => Ok(Some(resp.0)),
@@ -116,7 +116,7 @@ impl BitcoindRpcClient {
116116
pub(crate) async fn get_raw_mempool(&self) -> std::io::Result<Vec<Txid>> {
117117
let verbose_flag_json = serde_json::json!(false);
118118
self.rpc_client
119-
.call_method::<GetRawMempoolResponse>("getrawmempool", &vec![verbose_flag_json])
119+
.call_method::<GetRawMempoolResponse>("getrawmempool", &[verbose_flag_json])
120120
.await
121121
.map(|resp| resp.0)
122122
}
@@ -125,7 +125,7 @@ impl BitcoindRpcClient {
125125
let txid_hex = bitcoin::consensus::encode::serialize_hex(&txid);
126126
let txid_json = serde_json::json!(txid_hex);
127127
self.rpc_client
128-
.call_method::<GetMempoolEntryResponse>("getmempoolentry", &vec![txid_json])
128+
.call_method::<GetMempoolEntryResponse>("getmempoolentry", &[txid_json])
129129
.await
130130
.map(|resp| MempoolEntry { txid, height: resp.height, time: resp.time })
131131
}

0 commit comments

Comments
 (0)