void block_evaluation_state::add_output_delegate_votes( int32_t did, const asset& votes )
 {
    auto itr = _output_votes.find(did);
    if( itr == _output_votes.end() )
       _output_votes[did] = votes.get_rounded_amount();
    else
       itr->second += votes.get_rounded_amount();
 }
uint16_t trx_validation_state::find_unused_sig_output( const address& owner, const asset& bal )
{
  auto rounded_amount = asset(bal.get_rounded_amount(),bal.unit);
  ilog( "find unused sig output ${o}  ${bal}", ("o", owner)("bal",bal) );
  for( uint32_t i = 0; i < trx.outputs.size(); ++i )
  {
     if( used_outputs.find(i) == used_outputs.end() )
     {
        ilog( "out: ${i}", ("i",trx.outputs[i]) );
        if( trx.outputs[i].claim_func == claim_by_signature )
        {
           ilog( "amount: ${i} ==? ${r} ", ("i",trx.outputs[i].get_amount())("r",rounded_amount) );
           ilog( "round down amount: ${i} ==? ${r} ", ("i",trx.outputs[i].amount/5)("r",rounded_amount.amount.high_bits()/5) );
           if( trx.outputs[i].amount/5 == rounded_amount.amount.high_bits()/5 && trx.outputs[i].unit == bal.unit )
           {
              if( trx.outputs[i].as<claim_by_signature_output>().owner == owner )
              {
                 return i;
              }
           }
        }
     }
  }
  return output_not_found;
}
 void transaction_evaluation_state::add_required_fees( asset a )
 {
     auto itr = total.find( a.unit );
     if( itr == total.end() ) total[a.unit].required_fees = a.get_rounded_amount();
     else itr->second.required_fees += a.get_rounded_amount();
 }
 void transaction_evaluation_state::add_output_asset( asset a )
 {
     auto itr = total.find( a.unit );
     if( itr == total.end() ) total[a.unit].out = a.get_rounded_amount();
     else itr->second.out += a.get_rounded_amount();
 }
Пример #5
0
 trx_output( const ClaimType& t, const asset& a )
 :amount(a.get_rounded_amount()),unit(a.unit)
 {
    claim_func = ClaimType::type;
    claim_data = fc::raw::pack(t);
 }