Optimise to_network_msg: no need to clone to_sign
This commit is contained in:
parent
b858c68ae0
commit
12da1740e2
@ -238,17 +238,16 @@ impl Prd {
|
||||
/// Generate the signed proof and serialize to send over the network
|
||||
pub fn to_network_msg(&self, sp_wallet: &SpWallet) -> Result<String> {
|
||||
let spend_sk: SecretKey = sp_wallet.get_client().get_spend_key().try_into()?;
|
||||
let to_sign = self.clone(); // we sign the whole prd, incl the keys, for each recipient
|
||||
let mut to_sign = self.clone(); // we sign the whole prd, incl the keys, for each recipient
|
||||
|
||||
let message_hash =
|
||||
AnkHash::Message(AnkMessageHash::from_message(to_sign.to_string().as_bytes()));
|
||||
|
||||
let proof = Proof::new(message_hash, spend_sk);
|
||||
|
||||
let mut res = self.clone();
|
||||
res.proof = Some(proof);
|
||||
to_sign.proof = Some(proof);
|
||||
|
||||
Ok(res.to_string())
|
||||
Ok(to_sign.to_string())
|
||||
}
|
||||
|
||||
pub fn to_string(&self) -> String {
|
||||
|
Loading…
x
Reference in New Issue
Block a user