Skip to content

Commit

Permalink
Merge of #8076
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 10, 2023
2 parents 5dd33d7 + 36bcc9c commit a0c0459
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions zebra-rpc/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub trait Rpc {
fn get_raw_transaction(
&self,
txid_hex: String,
verbose: u8,
verbose: Option<u8>,
) -> BoxFuture<Result<GetRawTransaction>>;

/// Returns the transaction ids made by the provided transparent addresses.
Expand Down Expand Up @@ -945,10 +945,11 @@ where
fn get_raw_transaction(
&self,
txid_hex: String,
verbose: u8,
verbose: Option<u8>,
) -> BoxFuture<Result<GetRawTransaction>> {
let mut state = self.state.clone();
let mut mempool = self.mempool.clone();
let verbose = verbose.unwrap_or(0);
let verbose = verbose != 0;

async move {
Expand Down
4 changes: 2 additions & 2 deletions zebra-rpc/src/methods/tests/prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ proptest! {
NoChainTip,
);

let send_task = tokio::spawn(rpc.get_raw_transaction(non_hex_string, 0));
let send_task = tokio::spawn(rpc.get_raw_transaction(non_hex_string, Some(0)));

mempool.expect_no_requests().await?;
state.expect_no_requests().await?;
Expand Down Expand Up @@ -505,7 +505,7 @@ proptest! {
NoChainTip,
);

let send_task = tokio::spawn(rpc.get_raw_transaction(hex::encode(random_bytes), 0));
let send_task = tokio::spawn(rpc.get_raw_transaction(hex::encode(random_bytes), Some(0)));

mempool.expect_no_requests().await?;
state.expect_no_requests().await?;
Expand Down
4 changes: 2 additions & 2 deletions zebra-rpc/src/methods/tests/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async fn test_rpc_response_data_for_network(network: Network) {

// make the api call
let get_raw_transaction =
rpc.get_raw_transaction(first_block_first_transaction.hash().encode_hex(), 0u8);
rpc.get_raw_transaction(first_block_first_transaction.hash().encode_hex(), Some(0u8));
let (response, _) = futures::join!(get_raw_transaction, mempool_req);
let get_raw_transaction = response.expect("We should have a GetRawTransaction struct");

Expand All @@ -269,7 +269,7 @@ async fn test_rpc_response_data_for_network(network: Network) {

// make the api call
let get_raw_transaction =
rpc.get_raw_transaction(first_block_first_transaction.hash().encode_hex(), 1u8);
rpc.get_raw_transaction(first_block_first_transaction.hash().encode_hex(), Some(1u8));
let (response, _) = futures::join!(get_raw_transaction, mempool_req);
let get_raw_transaction = response.expect("We should have a GetRawTransaction struct");

Expand Down
6 changes: 3 additions & 3 deletions zebra-rpc/src/methods/tests/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ async fn rpc_getrawtransaction() {
conventional_fee: Amount::zero(),
}]));
});
let get_tx_req = rpc.get_raw_transaction(tx.hash().encode_hex(), 0u8);
let get_tx_req = rpc.get_raw_transaction(tx.hash().encode_hex(), Some(0u8));
let (response, _) = futures::join!(get_tx_req, mempool_req);
let get_tx = response.expect("We should have a GetRawTransaction struct");
if let GetRawTransaction::Raw(raw_tx) = get_tx {
Expand Down Expand Up @@ -454,8 +454,8 @@ async fn rpc_getrawtransaction() {
let run_state_test_case = |block_idx: usize, block: Arc<Block>, tx: Arc<Transaction>| {
let read_state = read_state.clone();
let tx_hash = tx.hash();
let get_tx_verbose_0_req = rpc.get_raw_transaction(tx_hash.encode_hex(), 0u8);
let get_tx_verbose_1_req = rpc.get_raw_transaction(tx_hash.encode_hex(), 1u8);
let get_tx_verbose_0_req = rpc.get_raw_transaction(tx_hash.encode_hex(), Some(0u8));
let get_tx_verbose_1_req = rpc.get_raw_transaction(tx_hash.encode_hex(), Some(1u8));

async move {
let (response, _) = futures::join!(get_tx_verbose_0_req, make_mempool_req(tx_hash));
Expand Down

0 comments on commit a0c0459

Please sign in to comment.