Skip to content

Commit 2169226

Browse files
committed
Fix: Segmentation fault when running several witness nodes on the
same machine. (see #377)
1 parent 0d30276 commit 2169226

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

libraries/chain/db_getter.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ node_property_object& database::node_properties()
9999

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

105112
const account_statistics_object& database::get_account_stats_by_owner( account_id_type owner )const

0 commit comments

Comments
 (0)