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

Fix : Segmentation fault when running several witness nodes on the same machine #1286

Merged
merged 2 commits into from
Aug 29, 2018
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
9 changes: 8 additions & 1 deletion libraries/chain/db_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ node_property_object& database::node_properties()

uint32_t database::last_non_undoable_block_num() const
{
return head_block_num() - _undo_db.size();
//see https://github.com/bitshares/bitshares-core/issues/377
/*
There is a case when a value of undo_db.size() is greater then head_block_num(),
and as result we get a wrong value for last_non_undoable_block_num.
To resolve it we should take into account a number of active_sessions in calculations of
last_non_undoable_block_num (active sessions are related to a new block which is under generation).
*/
return head_block_num() - ( _undo_db.size() - _undo_db.active_sessions() );
}

const account_statistics_object& database::get_account_stats_by_owner( account_id_type owner )const
Expand Down
1 change: 1 addition & 0 deletions libraries/db/include/graphene/db/undo_database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ namespace graphene { namespace db {
std::size_t size()const { return _stack.size(); }
void set_max_size(size_t new_max_size) { _max_size = new_max_size; }
size_t max_size()const { return _max_size; }
uint32_t active_sessions()const { return _active_sessions; }

const undo_state& head()const;

Expand Down