Skip to content

Commit

Permalink
Drop unnecessary vec! allocations in RPC calls
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Nov 22, 2024
1 parent 959285c commit a79f6f0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/chain/bitcoind_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl BitcoindRpcClient {
pub(crate) async fn broadcast_transaction(&self, tx: &Transaction) -> std::io::Result<Txid> {
let tx_serialized = bitcoin::consensus::encode::serialize_hex(tx);
let tx_json = serde_json::json!(tx_serialized);
self.rpc_client.call_method::<Txid>("sendrawtransaction", &vec![tx_json]).await
self.rpc_client.call_method::<Txid>("sendrawtransaction", &[tx_json]).await
}

pub(crate) async fn get_fee_estimate_for_target(
Expand All @@ -62,15 +62,15 @@ impl BitcoindRpcClient {
self.rpc_client
.call_method::<FeeResponse>(
"estimatesmartfee",
&vec![num_blocks_json, estimation_mode_json],
&[num_blocks_json, estimation_mode_json],
)
.await
.map(|resp| resp.0)
}

pub(crate) async fn get_mempool_minimum_fee_rate(&self) -> std::io::Result<FeeRate> {
self.rpc_client
.call_method::<MempoolMinFeeResponse>("getmempoolinfo", &vec![])
.call_method::<MempoolMinFeeResponse>("getmempoolinfo", &[])
.await
.map(|resp| resp.0)
}
Expand All @@ -82,7 +82,7 @@ impl BitcoindRpcClient {
let txid_json = serde_json::json!(txid_hex);
match self
.rpc_client
.call_method::<GetRawTransactionResponse>("getrawtransaction", &vec![txid_json])
.call_method::<GetRawTransactionResponse>("getrawtransaction", &[txid_json])
.await
{
Ok(resp) => Ok(Some(resp.0)),
Expand Down Expand Up @@ -116,7 +116,7 @@ impl BitcoindRpcClient {
pub(crate) async fn get_raw_mempool(&self) -> std::io::Result<Vec<Txid>> {
let verbose_flag_json = serde_json::json!(false);
self.rpc_client
.call_method::<GetRawMempoolResponse>("getrawmempool", &vec![verbose_flag_json])
.call_method::<GetRawMempoolResponse>("getrawmempool", &[verbose_flag_json])
.await
.map(|resp| resp.0)
}
Expand All @@ -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::<GetMempoolEntryResponse>("getmempoolentry", &vec![txid_json])
.call_method::<GetMempoolEntryResponse>("getmempoolentry", &[txid_json])
.await
.map(|resp| MempoolEntry { txid, height: resp.height, time: resp.time })
}
Expand Down

0 comments on commit a79f6f0

Please sign in to comment.