mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Use weight_as_block for quick weight check (#2443)
This commit is contained in:
parent
f3884f57b6
commit
f8aab05d76
1 changed files with 7 additions and 3 deletions
|
@ -409,9 +409,13 @@ impl Readable for TransactionBody {
|
|||
let (input_len, output_len, kernel_len) =
|
||||
ser_multiread!(reader, read_u64, read_u64, read_u64);
|
||||
|
||||
// quick block weight check before proceeding
|
||||
let tx_block_weight =
|
||||
TransactionBody::weight(input_len as usize, output_len as usize, kernel_len as usize);
|
||||
// Quick block weight check before proceeding.
|
||||
// Note: We use weight_as_block here (inputs have weight).
|
||||
let tx_block_weight = TransactionBody::weight_as_block(
|
||||
input_len as usize,
|
||||
output_len as usize,
|
||||
kernel_len as usize,
|
||||
);
|
||||
|
||||
if tx_block_weight > consensus::MAX_BLOCK_WEIGHT {
|
||||
return Err(ser::Error::TooLargeReadErr);
|
||||
|
|
Loading…
Reference in a new issue