Make a proper RctType enum

No longer caches RctType in the RctSignatures as well.
This commit is contained in:
Luke Parker
2023-07-04 11:22:53 -04:00
parent 35d7fa5f71
commit 6fe01d1f15
4 changed files with 196 additions and 82 deletions

View File

@@ -341,14 +341,14 @@ impl Transaction {
hashes.extend(self.prefix.hash());
self.rct_signatures.base.write(&mut buf, self.rct_signatures.prunable.rct_type()).unwrap();
self.rct_signatures.base.write(&mut buf, self.rct_signatures.rct_type()).unwrap();
hashes.extend(hash(&buf));
buf.clear();
match self.rct_signatures.prunable {
RctPrunable::Null => buf.resize(32, 0),
_ => {
self.rct_signatures.prunable.write(&mut buf).unwrap();
self.rct_signatures.prunable.write(&mut buf, self.rct_signatures.rct_type()).unwrap();
buf = hash(&buf).to_vec();
}
}
@@ -365,7 +365,7 @@ impl Transaction {
sig_hash.extend(self.prefix.hash());
self.rct_signatures.base.write(&mut buf, self.rct_signatures.prunable.rct_type()).unwrap();
self.rct_signatures.base.write(&mut buf, self.rct_signatures.rct_type()).unwrap();
sig_hash.extend(hash(&buf));
buf.clear();