Skip to content

Commit

Permalink
Merge pull request #2370 from bitshares/abitmore-patch-1
Browse files Browse the repository at this point in the history
Reduce the allowable range of negative latency
  • Loading branch information
abitmore authored Mar 5, 2021
2 parents 8eaeeba + bd552fd commit a6614f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit a6614f3

Please sign in to comment.