diff --git a/core/src/core/transaction.rs b/core/src/core/transaction.rs index fafb7749..a4cc978c 100644 --- a/core/src/core/transaction.rs +++ b/core/src/core/transaction.rs @@ -573,11 +573,18 @@ pub fn aggregate(transactions: Vec) -> Result { new_outputs.sort(); kernels.sort(); + // build a new aggregate tx from the following - + // * cut-through inputs + // * cut-through outputs + // * full set of tx kernels + // * sum of all kernel offsets let tx = Transaction::new(new_inputs, new_outputs, kernels).with_offset(total_kernel_offset); - // We need to check sums here as aggregation/cut-through - // may have created an invalid tx. - tx.verify_kernel_sums(tx.overage(), tx.offset)?; + // Now validate the aggregate tx to ensure we have not built something invalid. + // The resulting tx could be invalid for a variety of reasons - + // * tx too large (too many inputs|outputs|kernels) + // * cut-through may have invalidated the sums + tx.validate()?; Ok(tx) } @@ -641,8 +648,11 @@ pub fn deaggregate(mk_tx: Transaction, txs: Vec) -> Result