mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Rename Bulletproof::calculate_bp_clawback to Bulletproof::calculate_clawback
This commit is contained in:
@@ -91,7 +91,7 @@ impl Bulletproof {
|
|||||||
/// maximum amount of outputs will be returned.
|
/// maximum amount of outputs will be returned.
|
||||||
// https://github.com/monero-project/monero/blob/94e67bf96bbc010241f29ada6abc89f49a81759c/
|
// https://github.com/monero-project/monero/blob/94e67bf96bbc010241f29ada6abc89f49a81759c/
|
||||||
// src/cryptonote_basic/cryptonote_format_utils.cpp#L106-L124
|
// src/cryptonote_basic/cryptonote_format_utils.cpp#L106-L124
|
||||||
pub fn calculate_bp_clawback(plus: bool, n_outputs: usize) -> (usize, usize) {
|
pub fn calculate_clawback(plus: bool, n_outputs: usize) -> (usize, usize) {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
let mut LR_len = 0;
|
let mut LR_len = 0;
|
||||||
let mut n_padded_outputs = 1;
|
let mut n_padded_outputs = 1;
|
||||||
@@ -101,15 +101,15 @@ impl Bulletproof {
|
|||||||
}
|
}
|
||||||
LR_len += LOG_COMMITMENT_BITS;
|
LR_len += LOG_COMMITMENT_BITS;
|
||||||
|
|
||||||
let mut bp_clawback = 0;
|
let mut clawback = 0;
|
||||||
if n_padded_outputs > 2 {
|
if n_padded_outputs > 2 {
|
||||||
let fields = Bulletproof::bp_fields(plus);
|
let fields = Bulletproof::bp_fields(plus);
|
||||||
let base = ((fields + (2 * (LOG_COMMITMENT_BITS + 1))) * 32) / 2;
|
let base = ((fields + (2 * (LOG_COMMITMENT_BITS + 1))) * 32) / 2;
|
||||||
let size = (fields + (2 * LR_len)) * 32;
|
let size = (fields + (2 * LR_len)) * 32;
|
||||||
bp_clawback = ((base * n_padded_outputs) - size) * 4 / 5;
|
clawback = ((base * n_padded_outputs) - size) * 4 / 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
(bp_clawback, LR_len)
|
(clawback, LR_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prove the list of commitments are within [0 .. 2^64) with an aggregate Bulletproof.
|
/// Prove the list of commitments are within [0 .. 2^64) with an aggregate Bulletproof.
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ impl Transaction<NotPruned> {
|
|||||||
blob_size
|
blob_size
|
||||||
} else {
|
} else {
|
||||||
blob_size +
|
blob_size +
|
||||||
Bulletproof::calculate_bp_clawback(
|
Bulletproof::calculate_clawback(
|
||||||
bp_plus,
|
bp_plus,
|
||||||
match self {
|
match self {
|
||||||
Transaction::V1 { .. } => panic!("v1 transaction was BP(+)"),
|
Transaction::V1 { .. } => panic!("v1 transaction was BP(+)"),
|
||||||
|
|||||||
Reference in New Issue
Block a user