reject transaction that would not fit the block content size
@@ -71,10 +71,22 @@ impl FragmentSelectionAlgorithm for OldestFirst {
let id = fragment.id();
let fragment_raw = fragment.to_raw(); // TODO: replace everything to FragmentRaw in the node
let fragment_size = fragment_raw.size_bytes_plus_size() as u32;
+
+ let logger = self.logger.new(o!("hash" => id.to_string()));
+
+ if fragment_size > ledger_params.block_content_max_size {
+ let reason = format!(
+ "fragment size {} exceeds maximum block content size {}",
+ fragment_size, ledger_params.block_content_max_size
+ );
+ debug!(logger, "{}", reason);
+ logs.modify(id, FragmentStatus::Rejected { reason });
+ continue;
+ }
+
let total_size = self.current_total_size + fragment_size;
if total_size <= ledger_params.block_content_max_size {
- let logger = self.logger.new(o!("hash" => id.to_string()));
debug!(logger, "applying fragment in simulation");
match ledger_simulation.apply_fragment(ledger_params, &fragment, block_date) {
Ok(ledger_new) => {
