Add an output to update for pairing process
This commit is contained in:
parent
254bdfdb0d
commit
9b26dceb82
@ -323,11 +323,25 @@ fn commit_new_transaction(
|
|||||||
.ok_or(Error::msg("Wallet not initialized"))?
|
.ok_or(Error::msg("Wallet not initialized"))?
|
||||||
.get_wallet()?;
|
.get_wallet()?;
|
||||||
|
|
||||||
let recipient = Recipient {
|
let mut recipients = vec![];
|
||||||
|
recipients.push(Recipient {
|
||||||
address: sp_wallet.get_client().get_receiving_address(),
|
address: sp_wallet.get_client().get_receiving_address(),
|
||||||
amount: Amount::from_sat(1000),
|
amount: Amount::from_sat(1000),
|
||||||
nb_outputs: 1,
|
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 daemon = DAEMON.get().unwrap().lock_anyhow()?;
|
||||||
let fee_rate = daemon.estimate_fee(6)
|
let fee_rate = daemon.estimate_fee(6)
|
||||||
@ -350,7 +364,7 @@ fn commit_new_transaction(
|
|||||||
vec![mandatory_input],
|
vec![mandatory_input],
|
||||||
&freezed_utxos,
|
&freezed_utxos,
|
||||||
&sp_wallet,
|
&sp_wallet,
|
||||||
vec![recipient],
|
recipients,
|
||||||
Some(commitment_payload),
|
Some(commitment_payload),
|
||||||
fee_rate,
|
fee_rate,
|
||||||
None,
|
None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user