Make the `verbose` argument optional (#8076)
The `verbose` argument of the `getrawtransaction` RPC is specified as optional in the documentation: https://zcash.github.io/rpc/getrawtransaction.html.
This commit is contained in:
parent
5dd33d7265
commit
9acdf0e512
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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?;
|
||||
|
@ -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?;
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
@ -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");
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue