This commit is contained in:
Peter Conrad 2018-04-10 21:59:51 +02:00 committed by Fabian Schuh
parent fdd7c193a6
commit 12a8bdc590
No known key found for this signature in database
GPG key ID: F2538A4B282D6238
2 changed files with 7 additions and 2 deletions

View file

@ -58,12 +58,16 @@ namespace graphene { namespace chain {
FC_ASSERT( share < remaining );
payout *= share;
payout /= remaining;
//ilog("Paying ${p} of ${P} for ${s} of ${r}", ("p",payout.to_uint64())("P",to_pay.value)("s",share)("r",remaining) );
remaining -= share;
}
FC_ASSERT( payout.to_uint64() <= to_pay );
if( payout > 0 )
{
accumulator[affiliate] += asset( payout.to_uint64(), amount.asset_id );
if ( accumulator.find(affiliate) == accumulator.end() )
accumulator[affiliate] = asset( payout.to_uint64(), amount.asset_id );
else
accumulator[affiliate] += asset( payout.to_uint64(), amount.asset_id );
to_pay -= payout.to_uint64();
paid += payout.to_uint64();
}
@ -82,6 +86,7 @@ namespace graphene { namespace chain {
_db.adjust_balance( entry.first, entry.second );
_db.push_applied_operation( affiliate_payout_operation( entry.first, tag, entry.second ) );
}
accumulator.clear();
}
} } // graphene::chain

View file

@ -59,7 +59,7 @@ namespace graphene { namespace chain {
public:
template<typename GAME>
affiliate_payout_helper( database& db, const GAME& game )
: tag( get_tag_for_game( game ) ), _db(db) {}
: _db(db), tag( get_tag_for_game( game ) ) {}
share_type payout( account_id_type player, const asset& amount );
share_type payout( const account_object& player, const asset& amount );