From f8aab05d76d91b7d6e534fcf93d032a504d8739c Mon Sep 17 00:00:00 2001 From: Antioch Peverell Date: Tue, 22 Jan 2019 16:55:36 +0000 Subject: [PATCH] Use weight_as_block for quick weight check (#2443) --- core/src/core/transaction.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/core/transaction.rs b/core/src/core/transaction.rs index 5842ad2f3..122b9c773 100644 --- a/core/src/core/transaction.rs +++ b/core/src/core/transaction.rs @@ -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);