Skip to content

Commit

Permalink
make empty block in case validation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
madMAx43v3r committed Feb 21, 2025
1 parent ca99446 commit 7bc8103
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Node_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,14 +1007,17 @@ std::shared_ptr<const Block> Node::make_block(
}

uint64_t total_fees = 0;
if(block->height >= params->transaction_activation)
{
const auto deadline = get_time_ms() + params->block_interval_ms / 2;
const auto tx_list = validate_for_block(deadline);
// select transactions
for(const auto& entry : tx_list) {
block->tx_list.push_back(entry.tx);
total_fees += entry.fee;
if(block->height >= params->transaction_activation) {
try {
const auto deadline = get_time_ms() + params->block_interval_ms / 2;
const auto tx_list = validate_for_block(deadline);
// select transactions
for(const auto& entry : tx_list) {
block->tx_list.push_back(entry.tx);
total_fees += entry.fee;
}
} catch(const std::exception& ex) {
log(WARN) << "Making empty block due to: " << ex.what();
}
}

Expand Down

0 comments on commit 7bc8103

Please sign in to comment.