Fixed #429
This commit is contained in:
parent
8d8b84cc37
commit
4b0579b475
4 changed files with 34 additions and 1 deletions
|
|
@ -121,17 +121,27 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
|
|||
|
||||
void asset_create_evaluator::pay_fee()
|
||||
{
|
||||
fee_is_odd = core_fee_paid.value & 1;
|
||||
core_fee_paid -= core_fee_paid.value/2;
|
||||
generic_evaluator::pay_fee();
|
||||
}
|
||||
|
||||
object_id_type asset_create_evaluator::do_apply( const asset_create_operation& op )
|
||||
{ try {
|
||||
bool hf_429 = fee_is_odd && db().head_block_time() > HARDFORK_CORE_429_TIME;
|
||||
|
||||
const asset_dynamic_data_object& dyn_asset =
|
||||
db().create<asset_dynamic_data_object>( [&]( asset_dynamic_data_object& a ) {
|
||||
a.current_supply = 0;
|
||||
a.fee_pool = core_fee_paid; //op.calculate_fee(db().current_fee_schedule()).value / 2;
|
||||
a.fee_pool = core_fee_paid - (hf_429 ? 1 : 0);
|
||||
});
|
||||
if( fee_is_odd && !hf_429 )
|
||||
{
|
||||
const auto& core_dd = db().get<asset_object>( asset_id_type() ).dynamic_data( db() );
|
||||
db().modify( core_dd, [=]( asset_dynamic_data_object& dd ) {
|
||||
dd.current_supply++;
|
||||
});
|
||||
}
|
||||
|
||||
asset_bitasset_data_id_type bit_asset_id;
|
||||
if( op.bitasset_opts.valid() )
|
||||
|
|
|
|||
4
libraries/chain/hardfork.d/CORE_429.hf
Normal file
4
libraries/chain/hardfork.d/CORE_429.hf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// bitshares-core #429 rounding issue when creating assets
|
||||
#ifndef HARDFORK_CORE_429_TIME
|
||||
#define HARDFORK_CORE_429_TIME (fc::time_point_sec( 1511793600 ))
|
||||
#endif
|
||||
|
|
@ -40,6 +40,8 @@ namespace graphene { namespace chain {
|
|||
* post the fee to fee_paying_account_stats.pending_fees
|
||||
*/
|
||||
virtual void pay_fee() override;
|
||||
private:
|
||||
bool fee_is_odd;
|
||||
};
|
||||
|
||||
class asset_issue_evaluator : public evaluator<asset_issue_evaluator>
|
||||
|
|
|
|||
|
|
@ -990,6 +990,23 @@ BOOST_AUTO_TEST_CASE( issue_429_test )
|
|||
}
|
||||
|
||||
verify_asset_supplies( db );
|
||||
|
||||
generate_blocks( HARDFORK_CORE_429_TIME + 10 );
|
||||
|
||||
{
|
||||
signed_transaction tx;
|
||||
asset_create_operation op;
|
||||
op.issuer = alice_id;
|
||||
op.symbol = "ALICE.ODDER";
|
||||
op.common_options.core_exchange_rate = asset( 1 ) / asset( 1, asset_id_type( 1 ) );
|
||||
op.fee = asset((fees_to_pay.long_symbol + fees_to_pay.price_per_kbyte) | 1);
|
||||
tx.operations.push_back( op );
|
||||
set_expiration( db, tx );
|
||||
sign( tx, alice_private_key );
|
||||
PUSH_TX( db, tx );
|
||||
}
|
||||
|
||||
verify_asset_supplies( db );
|
||||
}
|
||||
catch( const fc::exception& e )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue