Skip to content

Commit

Permalink
improving test-catchain
Browse files Browse the repository at this point in the history
  • Loading branch information
neodix42 committed Jan 12, 2024
1 parent 77b2a89 commit 307aa40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion catchain/catchain-receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ void CatChainReceiverImpl::add_block_cont_3(tl_object_ptr<ton_api::catchain_bloc

run_scheduler();
if (!intentional_fork_) {
CHECK(last_sent_block_->delivered());
LOG_CHECK(last_sent_block_->delivered())
<< "source=" << last_sent_block_->get_source_id() << " ill=" << last_sent_block_->is_ill()
<< " height=" << last_sent_block_->get_height();
}

active_send_ = false;
Expand Down
9 changes: 7 additions & 2 deletions test/test-catchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class CatChainInst : public td::actor::Actor {

void create_fork() {
auto height = height_ - 1; //td::Random::fast(0, height_ - 1);
LOG(WARNING) << "Creating fork, source_id=" << idx_ << ", height=" << height;

auto sum = prev_values_[height] + 1;
td::uint64 x[2];
Expand Down Expand Up @@ -241,7 +242,8 @@ int main(int argc, char *argv[]) {
td::actor::send_closure(adnl, &ton::adnl::Adnl::register_network_manager, network_manager.get());
});

for (td::uint32 att = 0; att < 10; att++) {
for (td::uint32 att = 0; att < 20; att++) {
LOG(WARNING) << "Test #" << att;
nodes.resize(total_nodes);

scheduler.run_in_context([&] {
Expand Down Expand Up @@ -296,7 +298,10 @@ int main(int argc, char *argv[]) {
std::cout << "value=" << n.get_actor_unsafe().value() << std::endl;
}

scheduler.run_in_context([&] { td::actor::send_closure(inst[0], &CatChainInst::create_fork); });
td::uint32 fork_cnt = att < 10 ? 1 : (att - 10) / 5 + 2;
for (td::uint32 idx = 0; idx < fork_cnt; ++idx) {
scheduler.run_in_context([&] { td::actor::send_closure(inst[idx], &CatChainInst::create_fork); });
}

t = td::Timestamp::in(1.0);
while (scheduler.run(1)) {
Expand Down

0 comments on commit 307aa40

Please sign in to comment.