mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-23 19:15:59 +00:00
Properly calculate uniqueness when creating change outputs
It was missing sorting its inputs by their key images.
This commit is contained in:
parent
23d9d81bdb
commit
e1fd462a50
1 changed files with 8 additions and 2 deletions
|
@ -289,14 +289,20 @@ impl SignableTransaction {
|
|||
rpc: &Rpc,
|
||||
spend: &Scalar
|
||||
) -> Result<Transaction, TransactionError> {
|
||||
let mut images = Vec::with_capacity(self.inputs.len());
|
||||
for input in &self.inputs {
|
||||
images.push(generate_key_image(&(spend + input.key_offset)));
|
||||
}
|
||||
images.sort_by(|x, y| x.compress().to_bytes().cmp(&y.compress().to_bytes()).reverse());
|
||||
|
||||
let (commitments, mask_sum) = self.prepare_outputs(
|
||||
rng,
|
||||
Some(
|
||||
uniqueness(
|
||||
&self.inputs.iter().map(|input| Input::ToKey {
|
||||
&images.iter().map(|image| Input::ToKey {
|
||||
amount: 0,
|
||||
key_offsets: vec![],
|
||||
key_image: generate_key_image(&(spend + input.key_offset))
|
||||
key_image: *image
|
||||
}).collect::<Vec<_>>()
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue