Get the repo to compile again

This commit is contained in:
Luke Parker
2024-06-23 10:08:51 -04:00
parent 11dba9173f
commit 0b20004ba1
40 changed files with 1452 additions and 777 deletions

View File

@@ -115,7 +115,7 @@ impl TryFrom<u8> for RctType {
impl RctType {
/// True if this RctType uses compact encrypted amounts, false otherwise.
fn compact_encrypted_amounts(&self) -> bool {
pub fn compact_encrypted_amounts(&self) -> bool {
match self {
RctType::AggregateMlsagBorromean | RctType::MlsagBorromean | RctType::MlsagBulletproofs => {
false

View File

@@ -301,6 +301,14 @@ pub enum Transaction {
}
impl Transaction {
/// Get the version of this transaction.
pub fn version(&self) -> u8 {
match self {
Transaction::V1 { .. } => 1,
Transaction::V2 { .. } => 2,
}
}
/// Get the TransactionPrefix of this transaction.
pub fn prefix(&self) -> &TransactionPrefix {
match self {
@@ -308,6 +316,13 @@ impl Transaction {
}
}
/// Get a mutable reference to the TransactionPrefix of this transaction.
pub fn prefix_mut(&mut self) -> &mut TransactionPrefix {
match self {
Transaction::V1 { prefix, .. } | Transaction::V2 { prefix, .. } => prefix,
}
}
/// The weight of this Transaction, as relevant for fees.
// TODO: Replace ring_len, decoy_weights for &[&[usize]], where the inner buf is the decoy
// offsets
@@ -329,16 +344,15 @@ impl Transaction {
/// Some writable transactions may not be readable if they're malformed, per Monero's consensus
/// rules.
pub fn write<W: Write>(&self, w: &mut W) -> io::Result<()> {
write_varint(&self.version(), w)?;
match self {
Transaction::V1 { prefix, signatures } => {
write_varint(&1u8, w)?;
prefix.write(w)?;
for ring_sig in signatures {
ring_sig.write(w)?;
}
}
Transaction::V2 { prefix, proofs } => {
write_varint(&2u8, w)?;
prefix.write(w)?;
match proofs {
None => w.write_all(&[0])?,