diff --git a/src/client/rpc_api.rs b/src/client/rpc_api.rs index 81f92aa..15b4a7f 100644 --- a/src/client/rpc_api.rs +++ b/src/client/rpc_api.rs @@ -72,6 +72,13 @@ impl RpcApi for Client { txid: &bitcoin::Txid, _block_hash: Option<&bitcoin::BlockHash>, ) -> bitcoincore_rpc::Result { + if _block_hash.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_block_hash) + ))); + } + Ok(self.ledger.get_transaction(*txid)?) } /// Verbose flag enabled `get_raw_transaction`. @@ -87,6 +94,13 @@ impl RpcApi for Client { txid: &bitcoin::Txid, _block_hash: Option<&bitcoin::BlockHash>, ) -> bitcoincore_rpc::Result { + if _block_hash.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_block_hash) + ))); + } + let tx = self.get_raw_transaction(txid, _block_hash)?; let mut hex: Vec = Vec::new(); @@ -186,6 +200,13 @@ impl RpcApi for Client { txid: &bitcoin::Txid, _include_watchonly: Option, ) -> bitcoincore_rpc::Result { + if _include_watchonly.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_include_watchonly) + ))); + } + let raw_tx = self.get_raw_transaction(txid, None).unwrap(); let mut amount = Amount::from_sat(0); @@ -262,6 +283,43 @@ impl RpcApi for Client { _confirmation_target: Option, _estimate_mode: Option, ) -> bitcoincore_rpc::Result { + if _comment.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_comment) + ))); + } + if _comment_to.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_comment_to) + ))); + } + if _subtract_fee.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_subtract_fee) + ))); + } + if _replaceable.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_replaceable) + ))); + } + if _confirmation_target.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_confirmation_target) + ))); + } + if _estimate_mode.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_estimate_mode) + ))); + } + // First, create a random input. Why? Because calling this function for // same amount twice will trigger a database error about same TXID blah, // blah, blah. @@ -286,6 +344,19 @@ impl RpcApi for Client { _label: Option<&str>, _address_type: Option, ) -> bitcoincore_rpc::Result> { + if _label.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_label) + ))); + } + if _address_type.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_address_type) + ))); + } + let address = ledger::Ledger::get_constant_credential_from_witness().address; Ok(address.as_unchecked().to_owned()) @@ -320,6 +391,13 @@ impl RpcApi for Client { vout: u32, _include_mempool: Option, ) -> bitcoincore_rpc::Result> { + if let Some(false) = _include_mempool { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_include_mempool) + ))); + } + let bestblock = self.get_best_block_hash()?; let tx = self.get_raw_transaction(txid, None)?; @@ -377,6 +455,13 @@ impl RpcApi for Client { options: Option<&json::FundRawTransactionOptions>, _is_witness: Option, ) -> bitcoincore_rpc::Result { + if _is_witness.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_is_witness) + ))); + } + let mut transaction: Transaction = encode::deserialize_hex(&tx.raw_hex())?; tracing::debug!("Decoded input transaction: {transaction:?}"); @@ -447,6 +532,19 @@ impl RpcApi for Client { _utxos: Option<&[json::SignRawTransactionInput]>, _sighash_type: Option, ) -> bitcoincore_rpc::Result { + if _utxos.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_utxos) + ))); + } + if _sighash_type.is_some() { + return Err(Error::ReturnedError(format!( + "This argument is unimplemented: {}", + stringify!(_sighash_type) + ))); + } + let mut transaction: Transaction = encode::deserialize_hex(&tx.raw_hex())?; tracing::debug!("Decoded input transaction: {transaction:?}");