Fixed error when account_history_object with id 0 doesnt exist
This commit is contained in:
parent
e80e9dd401
commit
14b0d08d5a
1 changed files with 20 additions and 10 deletions
|
|
@ -555,18 +555,28 @@ namespace graphene { namespace app {
|
||||||
FC_ASSERT( limit <= 100 );
|
FC_ASSERT( limit <= 100 );
|
||||||
vector<operation_history_object> result;
|
vector<operation_history_object> result;
|
||||||
const auto& stats = account(db).statistics(db);
|
const auto& stats = account(db).statistics(db);
|
||||||
if( stats.most_recent_op == account_transaction_history_id_type() ) return result;
|
const account_transaction_history_object* node = nullptr;
|
||||||
const account_transaction_history_object* node = &stats.most_recent_op(db);
|
if( stats.most_recent_op != account_transaction_history_id_type() )
|
||||||
if( start == operation_history_id_type() )
|
|
||||||
start = node->operation_id;
|
|
||||||
|
|
||||||
while(node && node->operation_id.instance.value > stop.instance.value && result.size() < limit)
|
|
||||||
{
|
{
|
||||||
if( node->operation_id.instance.value <= start.instance.value )
|
node = &stats.most_recent_op(db);
|
||||||
|
if( start == operation_history_id_type() )
|
||||||
|
start = node->operation_id;
|
||||||
|
|
||||||
|
while(node && node->operation_id.instance.value > stop.instance.value && result.size() < limit)
|
||||||
|
{
|
||||||
|
if( node->operation_id.instance.value <= start.instance.value )
|
||||||
|
result.push_back( node->operation_id(db) );
|
||||||
|
if( node->next == account_transaction_history_id_type() )
|
||||||
|
node = nullptr;
|
||||||
|
else node = &node->next(db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( stop.instance.value == 0 && result.size() < limit )
|
||||||
|
{
|
||||||
|
node = db.find(account_transaction_history_id_type());
|
||||||
|
if( node && node->operation_id.instance.value == account.instance.value)
|
||||||
result.push_back( node->operation_id(db) );
|
result.push_back( node->operation_id(db) );
|
||||||
if( node->next == account_transaction_history_id_type() )
|
|
||||||
node = nullptr;
|
|
||||||
else node = &node->next(db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue