提交 ac64a14f 编写于 作者: A Anton Perkov

read-mode = irreversible #4196

上级 4a8eead7
......@@ -184,6 +184,12 @@ struct controller_impl {
reversible_blocks.remove( *objitr );
objitr = ubi.begin();
}
if ( read_mode == db_read_mode::IRREVERSIBLE ) {
apply_block( s->block, controller::block_status::complete );
fork_db.mark_in_current_chain( s, true );
fork_db.set_validity( s, true );
head = s;
}
}
void init() {
......@@ -862,7 +868,9 @@ struct controller_impl {
bool trust = !conf.force_all_checks && (s == controller::block_status::irreversible || s == controller::block_status::validated);
auto new_header_state = fork_db.add( b, trust );
emit( self.accepted_block_header, new_header_state );
if ( read_mode != db_read_mode::IRREVERSIBLE ) {
maybe_switch_forks( s );
}
} FC_LOG_AND_RETHROW( )
}
......@@ -870,8 +878,10 @@ struct controller_impl {
FC_ASSERT(!pending, "it is not valid to push a confirmation when there is a pending block");
fork_db.add( c );
emit( self.accepted_confirmation, c );
if ( read_mode != db_read_mode::IRREVERSIBLE ) {
maybe_switch_forks();
}
}
void maybe_switch_forks( controller::block_status s = controller::block_status::complete ) {
auto new_head = fork_db.head();
......
......@@ -251,7 +251,7 @@ namespace eosio { namespace chain {
auto itr = my->index.find( h->id );
if( itr != my->index.end() ) {
irreversible(*itr);
irreversible(*itr); //XXX
my->index.erase(itr);
}
......
......@@ -35,7 +35,8 @@ namespace eosio { namespace chain {
enum class db_read_mode {
SPECULATIVE,
HEAD
HEAD,
IRREVERSIBLE
};
class controller {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册