From c00ee91522fe62f72c1b6460c8cf5b2a98047a0f Mon Sep 17 00:00:00 2001 From: Luiz Parreira Date: Tue, 28 Sep 2021 16:31:35 -0300 Subject: [PATCH] Add additional options to sendtoaddress as per 0.21.0 docs Docs: https://bitcoincore.org/en/doc/0.21.0/rpc/wallet/sendtoaddress/ --- client/src/client.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/client.rs b/client/src/client.rs index 651acd96..674a60ac 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -121,9 +121,6 @@ fn handle_defaults<'a, 'b>( let defaults_i = defaults.len() - 1 - i; if args[args_i] == serde_json::Value::Null { if first_non_null_optional_idx.is_some() { - if defaults[defaults_i] == serde_json::Value::Null { - panic!("Missing `default` for argument idx {}", args_i); - } args[args_i] = defaults[defaults_i].clone(); } } else if first_non_null_optional_idx.is_none() { @@ -888,6 +885,8 @@ pub trait RpcApi: Sized { replaceable: Option, confirmation_target: Option, estimate_mode: Option, + avoid_reuse: Option, + fee_rate: Option, ) -> Result { let mut args = [ address.to_string().into(), @@ -898,12 +897,14 @@ pub trait RpcApi: Sized { opt_into_json(replaceable)?, opt_into_json(confirmation_target)?, opt_into_json(estimate_mode)?, + opt_into_json(avoid_reuse)?, + opt_into_json(fee_rate)?, ]; self.call( "sendtoaddress", handle_defaults( &mut args, - &["".into(), "".into(), false.into(), false.into(), 6.into(), null()], + &["".into(), "".into(), false.into(), false.into(), null(), null(), null(), null()], ), ) }