Refactor non_input_size

Looks like the formatter has put code comments in the wrong place.

Refactor the `non_input_size` line so that the formatter does not mess
with it.
This commit is contained in:
Tobin C. Harding 2024-12-12 11:56:18 +11:00
parent f42f13cd8d
commit 0135cddc32
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 5 additions and 9 deletions

View File

@ -883,15 +883,11 @@ const fn predict_weight_internal(
) -> Weight { ) -> Weight {
// The value field of a TxOut is 8 bytes. // The value field of a TxOut is 8 bytes.
let output_size = 8 * output_count + output_scripts_size; let output_size = 8 * output_count + output_scripts_size;
let non_input_size = let non_input_size = 4 // version
// version: + compact_size::encoded_size_const(input_count as u64) // Can't use ToU64 in const context.
4 + + compact_size::encoded_size_const(output_count as u64)
// count varints: + output_size
compact_size::encoded_size_const(input_count as u64) + + 4; // locktime
compact_size::encoded_size_const(output_count as u64) +
output_size +
// lock_time
4;
let weight = if inputs_with_witnesses == 0 { let weight = if inputs_with_witnesses == 0 {
non_input_size * 4 + input_weight non_input_size * 4 + input_weight
} else { } else {