Skip to content

Commit

Permalink
GH-239 Only reject blocks from the future on BP nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Nov 15, 2024
1 parent be54b82 commit 913e094
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ namespace eosio::chain {
void replace_account_keys( name account, name permission, const public_key_type& key );

void set_producer_node(bool is_producer_node);
bool is_producer_node()const;
bool is_producer_node()const; // thread safe, set at program initialization

void set_db_read_only_mode();
void unset_db_read_only_mode();
Expand Down
6 changes: 4 additions & 2 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3716,8 +3716,10 @@ namespace eosio {
bool unlinkable = false;
sync_manager::closing_mode close_mode = sync_manager::closing_mode::immediately;
try {
EOS_ASSERT(ptr->timestamp < (fc::time_point::now() + fc::seconds(7)), block_from_the_future,
"received a block from the future, rejecting it: ${id}", ("id", id));
if (cc.is_producer_node()) {
EOS_ASSERT(ptr->timestamp < (fc::time_point::now() + fc::seconds(7)), block_from_the_future,
"received a block from the future, rejecting it: ${id}", ("id", id));
}
// this will return empty optional<block_handle> if block is not linkable
controller::accepted_block_result abh = cc.accept_block( id, ptr );
best_head = abh.is_new_best_head;
Expand Down

0 comments on commit 913e094

Please sign in to comment.