Fix internal weight calculation
This function calls helper function predict_weight_internal and that function was refactored. The refactor changed the interface to accept the input_weight instead of partial input_weight, however this function was not updated with the refactor and was still passing a partial input weight. This commit is a followup that fixes the internal calculation error by pass input_weight instead of partial_weight to the helper function predict_weight_internal.
This commit is contained in:
parent
cefcce5bbf
commit
3352032892
|
@ -920,14 +920,14 @@ pub const fn predict_weight_from_slices(
|
|||
inputs: &[InputWeightPrediction],
|
||||
output_script_lens: &[usize],
|
||||
) -> Weight {
|
||||
let mut partial_input_weight = 0;
|
||||
let mut input_weight = 0;
|
||||
let mut inputs_with_witnesses = 0;
|
||||
|
||||
// for loops not supported in const fn
|
||||
let mut i = 0;
|
||||
while i < inputs.len() {
|
||||
let prediction = inputs[i];
|
||||
partial_input_weight += prediction.witness_weight().to_wu() as usize;
|
||||
input_weight += prediction.total_weight().to_wu() as usize;
|
||||
inputs_with_witnesses += (prediction.witness_size > 0) as usize;
|
||||
i += 1;
|
||||
}
|
||||
|
@ -943,7 +943,7 @@ pub const fn predict_weight_from_slices(
|
|||
|
||||
predict_weight_internal(
|
||||
inputs.len(),
|
||||
partial_input_weight,
|
||||
input_weight,
|
||||
inputs_with_witnesses,
|
||||
output_script_lens.len(),
|
||||
output_scripts_size,
|
||||
|
|
Loading…
Reference in New Issue