Add fee handling code to Monero

Updates how change outputs are handled, with a far more logical 
construction offering greater flexibility.

prepare_outputs can not longer error. SignaableTransaction::new will.
This commit is contained in:
Luke Parker
2022-06-19 12:03:01 -04:00
parent 71fca06120
commit f50f249468
11 changed files with 231 additions and 107 deletions

View File

@@ -15,7 +15,8 @@ use crate::{
Commitment,
wallet::decoys::Decoys,
random_scalar, hash_to_scalar, hash_to_point,
serialize::*
serialize::*,
transaction::RING_LEN
};
#[cfg(feature = "multisig")]
@@ -287,6 +288,10 @@ impl Clsag {
Ok(())
}
pub(crate) fn fee_weight() -> usize {
(RING_LEN * 32) + 32 + 32
}
pub fn serialize<W: std::io::Write>(&self, w: &mut W) -> std::io::Result<()> {
write_raw_vec(write_scalar, &self.s, w)?;
w.write_all(&self.c1.to_bytes())?;