mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 20:59:23 +00:00
This commit is contained in:
@@ -129,9 +129,9 @@ async fn prepare_inputs<R: RngCore + CryptoRng>(
|
||||
|
||||
for (i, input) in inputs.iter().enumerate() {
|
||||
signable.push((
|
||||
spend + input.key_offset,
|
||||
generate_key_image(spend + input.key_offset),
|
||||
ClsagInput::new(input.commitment.clone(), decoys[i].clone())
|
||||
spend + input.output.data.key_offset,
|
||||
generate_key_image(spend + input.output.data.key_offset),
|
||||
ClsagInput::new(input.commitment().clone(), decoys[i].clone())
|
||||
.map_err(TransactionError::ClsagError)?,
|
||||
));
|
||||
|
||||
@@ -225,7 +225,7 @@ impl SignableTransaction {
|
||||
fee_rate.calculate(Transaction::fee_weight(protocol, inputs.len(), outputs, extra));
|
||||
|
||||
// Make sure we have enough funds
|
||||
let in_amount = inputs.iter().map(|input| input.commitment.amount).sum::<u64>();
|
||||
let in_amount = inputs.iter().map(|input| input.commitment().amount).sum::<u64>();
|
||||
let mut out_amount = payments.iter().map(|payment| payment.1).sum::<u64>() + fee;
|
||||
if in_amount < out_amount {
|
||||
Err(TransactionError::NotEnoughFunds(in_amount, out_amount))?;
|
||||
@@ -345,8 +345,8 @@ impl SignableTransaction {
|
||||
) -> Result<Transaction, TransactionError> {
|
||||
let mut images = Vec::with_capacity(self.inputs.len());
|
||||
for input in &self.inputs {
|
||||
let mut offset = spend + input.key_offset;
|
||||
if (&offset * &ED25519_BASEPOINT_TABLE) != input.key {
|
||||
let mut offset = spend + input.output.data.key_offset;
|
||||
if (&offset * &ED25519_BASEPOINT_TABLE) != input.output.data.key {
|
||||
Err(TransactionError::WrongPrivateKey)?;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,11 +100,11 @@ impl SignableTransaction {
|
||||
for input in &self.inputs {
|
||||
// These outputs can only be spent once. Therefore, it forces all RNGs derived from this
|
||||
// transcript (such as the one used to create one time keys) to be unique
|
||||
transcript.append_message(b"input_hash", &input.tx);
|
||||
transcript.append_message(b"input_output_index", &[input.o]);
|
||||
transcript.append_message(b"input_hash", &input.output.absolute.tx);
|
||||
transcript.append_message(b"input_output_index", &[input.output.absolute.o]);
|
||||
// Not including this, with a doxxed list of payments, would allow brute forcing the inputs
|
||||
// to determine RNG seeds and therefore the true spends
|
||||
transcript.append_message(b"input_shared_key", &input.key_offset.to_bytes());
|
||||
transcript.append_message(b"input_shared_key", &input.output.data.key_offset.to_bytes());
|
||||
}
|
||||
for payment in &self.payments {
|
||||
transcript.append_message(b"payment_address", payment.0.to_string().as_bytes());
|
||||
@@ -116,14 +116,14 @@ impl SignableTransaction {
|
||||
|
||||
for (i, input) in self.inputs.iter().enumerate() {
|
||||
// Check this the right set of keys
|
||||
let offset = keys.offset(dalek_ff_group::Scalar(input.key_offset));
|
||||
if offset.group_key().0 != input.key {
|
||||
let offset = keys.offset(dalek_ff_group::Scalar(input.output.data.key_offset));
|
||||
if offset.group_key().0 != input.output.data.key {
|
||||
Err(TransactionError::WrongPrivateKey)?;
|
||||
}
|
||||
|
||||
clsags.push(
|
||||
AlgorithmMachine::new(
|
||||
ClsagMultisig::new(transcript.clone(), input.key, inputs[i].clone())
|
||||
ClsagMultisig::new(transcript.clone(), input.output.data.key, inputs[i].clone())
|
||||
.map_err(TransactionError::MultisigError)?,
|
||||
offset,
|
||||
&included,
|
||||
@@ -331,7 +331,7 @@ impl SignMachine<Transaction> for TransactionSignMachine {
|
||||
});
|
||||
|
||||
*value.3.write().unwrap() = Some(ClsagDetails::new(
|
||||
ClsagInput::new(value.1.commitment.clone(), value.2).map_err(|_| {
|
||||
ClsagInput::new(value.1.commitment().clone(), value.2).map_err(|_| {
|
||||
panic!("Signing an input which isn't present in the ring we created for it")
|
||||
})?,
|
||||
mask,
|
||||
|
||||
Reference in New Issue
Block a user