mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-11 13:39:25 +00:00
fix non-miner v1 txs
This commit is contained in:
@@ -207,7 +207,7 @@ impl TransactionPrefix {
|
|||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Transaction {
|
pub struct Transaction {
|
||||||
pub prefix: TransactionPrefix,
|
pub prefix: TransactionPrefix,
|
||||||
pub signatures: Vec<(Scalar, Scalar)>,
|
pub signatures: Vec<Vec<(Scalar, Scalar)>>,
|
||||||
pub rct_signatures: RctSignatures,
|
pub rct_signatures: RctSignatures,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,9 +225,11 @@ impl Transaction {
|
|||||||
pub fn write<W: Write>(&self, w: &mut W) -> io::Result<()> {
|
pub fn write<W: Write>(&self, w: &mut W) -> io::Result<()> {
|
||||||
self.prefix.write(w)?;
|
self.prefix.write(w)?;
|
||||||
if self.prefix.version == 1 {
|
if self.prefix.version == 1 {
|
||||||
for sig in &self.signatures {
|
for sigs in &self.signatures {
|
||||||
write_scalar(&sig.0, w)?;
|
for sig in sigs {
|
||||||
write_scalar(&sig.1, w)?;
|
write_scalar(&sig.0, w)?;
|
||||||
|
write_scalar(&sig.1, w)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
} else if self.prefix.version == 2 {
|
} else if self.prefix.version == 2 {
|
||||||
@@ -252,11 +254,18 @@ impl Transaction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if prefix.version == 1 {
|
if prefix.version == 1 {
|
||||||
if !matches!(prefix.inputs[0], Input::Gen(_)) {
|
let read_sig =
|
||||||
for _ in 0 .. prefix.inputs.len() {
|
|r: &mut R| -> io::Result<(Scalar, Scalar)> { Ok((read_scalar(r)?, read_scalar(r)?)) };
|
||||||
signatures.push((read_scalar(r)?, read_scalar(r)?));
|
signatures = prefix
|
||||||
}
|
.inputs
|
||||||
}
|
.iter()
|
||||||
|
.filter_map(|input| match input {
|
||||||
|
Input::ToKey { key_offsets, .. } => {
|
||||||
|
Some(key_offsets.iter().map(|_| (read_sig(r))).collect::<Result<Vec<(_, _)>, _>>())
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.collect::<Result<Vec<Vec<(Scalar, Scalar)>>, _>>()?;
|
||||||
|
|
||||||
rct_signatures.base.fee = prefix
|
rct_signatures.base.fee = prefix
|
||||||
.inputs
|
.inputs
|
||||||
|
|||||||
Reference in New Issue
Block a user