Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the allowable range of negative latency #2370

Merged
merged 2 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ bool application_impl::handle_block(const graphene::net::block_message& blk_msg,
("w",witness_account.name)
("i",last_irr)("d",blk_msg.block.block_num()-last_irr) );
}
GRAPHENE_ASSERT( latency.count()/1000 > -5000,
GRAPHENE_ASSERT( latency.count()/1000 > -2500, // 2.5 seconds
graphene::net::block_timestamp_in_future_exception,
"Rejecting block with timestamp in the future", );

Expand Down
5 changes: 5 additions & 0 deletions tests/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ BOOST_AUTO_TEST_CASE( two_node_network )
BOOST_TEST_MESSAGE( "Generating block on db2" );
fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));

// the other node will reject the block if its timestamp is in the future, so we wait
fc::wait_for( BROADCAST_WAIT_TIME, [db2] () {
return db2->get_slot_time(1) <= fc::time_point::now();
});

auto block_1 = db2->generate_block(
db2->get_slot_time(1),
db2->get_scheduled_witness(1),
Expand Down