Skip to content

Commit

Permalink
Merge branch 'bug/386-assert-operation_history_object' into 'develop'
Browse files Browse the repository at this point in the history
#386 - check valid() for optional<operation_history_object>

See merge request PBSA/peerplays!126
  • Loading branch information
serkixenos committed Jun 10, 2022
2 parents b05c36b + 2a373a7 commit 29189b3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libraries/chain/db_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,12 @@ processed_transaction database::push_proposal(const proposal_object& proposal)
{
for( size_t i=old_applied_ops_size,n=_applied_ops.size(); i<n; i++ )
{
ilog( "removing failed operation from applied_ops: ${op}", ("op", *(_applied_ops[i])) );
if(_applied_ops[i].valid()) {
ilog("removing failed operation from applied_ops: ${op}", ("op", *(_applied_ops[i])));
}
else{
ilog("Can't remove failed operation from applied_ops (operation is not valid), op_id : ${op_id}", ("op_id", i));
}
_applied_ops[i].reset();
}
}
Expand Down Expand Up @@ -619,7 +624,7 @@ uint32_t database::push_applied_operation( const operation& op )
void database::set_applied_operation_result( uint32_t op_id, const operation_result& result )
{
assert( op_id < _applied_ops.size() );
if( _applied_ops[op_id] )
if( _applied_ops[op_id].valid() )
_applied_ops[op_id]->result = result;
else
{
Expand Down

0 comments on commit 29189b3

Please sign in to comment.