Add a TX size check to Monero

This isn't perfect yet should ensure the eventual TX is less than 100k bytes.
This commit is contained in:
Luke Parker
2023-03-12 03:54:30 -04:00
parent 36034c2f72
commit 41a285ddfa
2 changed files with 20 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ impl Bulletproofs {
pub(crate) fn fee_weight(plus: bool, outputs: usize) -> usize {
let fields = if plus { 6 } else { 9 };
// TODO: Shouldn't this use u32/u64?
#[allow(non_snake_case)]
let mut LR_len = usize::try_from(usize::BITS - (outputs - 1).leading_zeros()).unwrap();
let padded_outputs = 1 << LR_len;