gui: pass change_address param to createspend
This commit is contained in:
parent
a34070dce1
commit
fae32df086
@ -381,7 +381,7 @@ impl Step for DefineSpend {
|
||||
return Command::perform(
|
||||
async move {
|
||||
daemon
|
||||
.create_spend_tx(&inputs, &outputs, feerate_vb)
|
||||
.create_spend_tx(&inputs, &outputs, feerate_vb, None)
|
||||
.map_err(|e| e.into())
|
||||
.and_then(|res| match res {
|
||||
CreateSpendResult::Success { psbt, .. } => Ok(psbt),
|
||||
|
||||
@ -86,15 +86,17 @@ impl<C: Client + Debug> Daemon for Lianad<C> {
|
||||
coins_outpoints: &[OutPoint],
|
||||
destinations: &HashMap<Address<address::NetworkUnchecked>, u64>,
|
||||
feerate_vb: u64,
|
||||
change_address: Option<Address<address::NetworkUnchecked>>,
|
||||
) -> Result<CreateSpendResult, DaemonError> {
|
||||
self.call(
|
||||
"createspend",
|
||||
Some(vec![
|
||||
json!(destinations),
|
||||
json!(coins_outpoints),
|
||||
json!(feerate_vb),
|
||||
]),
|
||||
)
|
||||
let mut input = vec![
|
||||
json!(destinations),
|
||||
json!(coins_outpoints),
|
||||
json!(feerate_vb),
|
||||
];
|
||||
if let Some(change_address) = change_address {
|
||||
input.push(json!(change_address));
|
||||
}
|
||||
self.call("createspend", Some(input))
|
||||
}
|
||||
|
||||
fn rbf_psbt(
|
||||
|
||||
@ -87,9 +87,10 @@ impl Daemon for EmbeddedDaemon {
|
||||
coins_outpoints: &[OutPoint],
|
||||
destinations: &HashMap<Address<address::NetworkUnchecked>, u64>,
|
||||
feerate_vb: u64,
|
||||
change_address: Option<Address<address::NetworkUnchecked>>,
|
||||
) -> Result<CreateSpendResult, DaemonError> {
|
||||
self.control()?
|
||||
.create_spend(destinations, coins_outpoints, feerate_vb, None)
|
||||
.create_spend(destinations, coins_outpoints, feerate_vb, change_address)
|
||||
.map_err(|e| DaemonError::Unexpected(e.to_string()))
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ pub trait Daemon: Debug {
|
||||
coins_outpoints: &[OutPoint],
|
||||
destinations: &HashMap<Address<address::NetworkUnchecked>, u64>,
|
||||
feerate_vb: u64,
|
||||
change_address: Option<Address<address::NetworkUnchecked>>,
|
||||
) -> Result<model::CreateSpendResult, DaemonError>;
|
||||
fn rbf_psbt(
|
||||
&self,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user