Add an output to update for pairing process
This commit is contained in:
parent
f722dee8f6
commit
2cc026077e
@ -323,11 +323,25 @@ fn commit_new_transaction(
|
||||
.ok_or(Error::msg("Wallet not initialized"))?
|
||||
.get_wallet()?;
|
||||
|
||||
let recipient = Recipient {
|
||||
let mut recipients = vec![];
|
||||
recipients.push(Recipient {
|
||||
address: sp_wallet.get_client().get_receiving_address(),
|
||||
amount: Amount::from_sat(1000),
|
||||
nb_outputs: 1,
|
||||
};
|
||||
});
|
||||
|
||||
// If the process is a pairing, we add another output that directly pays the owner of the process
|
||||
// We can find out simply by looking at the members list
|
||||
if let Some(member) = lock_members()?.get(&updated_process.get_process_id().unwrap()) {
|
||||
// We just pick one of the devices of the member at random en pay to it, member can then share the private key between all devices
|
||||
// For now we take the first address
|
||||
recipients.push(Recipient {
|
||||
address: member.get_addresses().iter().next().unwrap().to_string(),
|
||||
amount: Amount::from_sat(1000),
|
||||
nb_outputs: 1
|
||||
});
|
||||
}
|
||||
// This output is used to generate publicly available public keys without having to go through too many loops
|
||||
|
||||
let daemon = DAEMON.get().unwrap().lock_anyhow()?;
|
||||
let fee_rate = daemon.estimate_fee(6)
|
||||
@ -350,7 +364,7 @@ fn commit_new_transaction(
|
||||
vec![mandatory_input],
|
||||
&freezed_utxos,
|
||||
&sp_wallet,
|
||||
vec![recipient],
|
||||
recipients,
|
||||
Some(commitment_payload),
|
||||
fee_rate,
|
||||
None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user