From f11fc1b49e9401ff8f4883c8698c84200614fe44 Mon Sep 17 00:00:00 2001 From: Abit Date: Fri, 5 Mar 2021 17:56:29 +0100 Subject: [PATCH 1/2] Reduce the allowable range of negative latency --- libraries/app/application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index a1403e2c7f..3a388befcd 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -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", ); From bd552fdbf81be4a7e2b81261690e9705c992c886 Mon Sep 17 00:00:00 2001 From: Abit Date: Fri, 5 Mar 2021 22:25:09 +0100 Subject: [PATCH 2/2] Update test case for negative latency change --- tests/app/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/app/main.cpp b/tests/app/main.cpp index a0d1b9b168..afd1cf0f61 100644 --- a/tests/app/main.cpp +++ b/tests/app/main.cpp @@ -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),