Skip to content

Commit

Permalink
Merge pull request steemit#2127 from steemit/2122-fix-delegation-api
Browse files Browse the repository at this point in the history
Fix condenser_api delegation API calls
  • Loading branch information
Michael Vandeberg authored Feb 16, 2018
2 parents 1907cfc + ac81eb4 commit 3cecc12
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libraries/plugins/apis/condenser_api/condenser_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,16 +1042,17 @@ namespace detail
FC_ASSERT( args.size() == 2 || args.size() == 3, "Expected 2-3 arguments, was ${n}", ("n", args.size()) );
database_api::list_vesting_delegations_args a;
account_name_type account = args[0].as< account_name_type >();
a.start = fc::variant( (vector< variant >){ args[0], args[1] } );
a.limit = args.size() == 3 ? args[2].as< uint32_t >() : 100;
a.order = database_api::by_delegation;
auto delegations = _database_api->list_vesting_delegations( a ).delegations;
get_vesting_delegations_return result;
for( auto& d : delegations )
for( auto itr = delegations.begin(); itr != delegations.end() && itr->delegator == account; ++itr )
{
result.push_back( api_vesting_delegation_object( d ) );
result.push_back( api_vesting_delegation_object( *itr ) );
}
return result;
Expand All @@ -1062,16 +1063,17 @@ namespace detail
FC_ASSERT( args.size() == 2 || args.size() == 3, "Expected 2-3 arguments, was ${n}", ("n", args.size()) );
database_api::list_vesting_delegation_expirations_args a;
a.start = fc::variant( (vector< variant >){ args[0], args[1] } );
account_name_type account = args[0].as< account_name_type >();
a.start = fc::variant( (vector< variant >){ args[0], args[1], fc::variant( vesting_delegation_expiration_id_type() ) } );
a.limit = args.size() == 3 ? args[2].as< uint32_t >() : 100;
a.order = database_api::by_account_expiration;
auto delegations = _database_api->list_vesting_delegation_expirations( a ).delegations;
get_expiring_vesting_delegations_return result;
for( auto& d : delegations )
for( auto itr = delegations.begin(); itr != delegations.end() && itr->delegator == account; ++itr )
{
result.push_back( api_vesting_delegation_expiration_object( d ) );
result.push_back( api_vesting_delegation_expiration_object( *itr ) );
}
return result;
Expand Down

0 comments on commit 3cecc12

Please sign in to comment.