HARDFORK: fix for hung cancel order

This commit is contained in:
Daniel Larimer 2016-01-28 20:02:37 -05:00
parent d9db27d416
commit 405f81eaf8
4 changed files with 24 additions and 19 deletions

View file

@ -293,14 +293,14 @@ signed_block database::generate_block(
const fc::ecc::private_key& block_signing_private_key,
uint32_t skip /* = 0 */
)
{
{ try {
signed_block result;
detail::with_skip_flags( *this, skip, [&]()
{
result = _generate_block( when, witness_id, block_signing_private_key );
} );
return result;
}
} FC_CAPTURE_AND_RETHROW() }
signed_block database::_generate_block(
fc::time_point_sec when,

View file

@ -152,14 +152,14 @@ void database::update_last_irreversible_block()
}
void database::clear_expired_transactions()
{
{ try {
//Look for expired transactions in the deduplication list, and remove them.
//Transactions must have expired by at least two forking windows in order to be removed.
auto& transaction_idx = static_cast<transaction_index&>(get_mutable_index(implementation_ids, impl_transaction_object_type));
const auto& dedupe_index = transaction_idx.indices().get<by_expiration>();
while( (!dedupe_index.empty()) && (head_block_time() > dedupe_index.rbegin()->trx.expiration) )
transaction_idx.remove(*dedupe_index.rbegin());
}
} FC_CAPTURE_AND_RETHROW() }
void database::clear_expired_proposals()
{
@ -250,7 +250,7 @@ bool database::check_for_blackswan( const asset_object& mia, bool enable_black_s
}
void database::clear_expired_orders()
{
{ try {
detail::with_skip_flags( *this,
get_node_properties().skip_flags | skip_authority_check, [&](){
transaction_evaluation_state cancel_context(this);
@ -263,6 +263,7 @@ void database::clear_expired_orders()
const limit_order_object& order = *limit_index.begin();
canceler.fee_paying_account = order.seller;
canceler.order = order.id;
cancel_context.skip_fee = true;
apply_operation(cancel_context, canceler);
}
});
@ -368,7 +369,7 @@ void database::clear_expired_orders()
});
}
}
}
} FC_CAPTURE_AND_RETHROW() }
void database::update_expired_feeds()
{

View file

@ -76,24 +76,27 @@ database& generic_evaluator::db()const { return trx_state->db(); }
void generic_evaluator::convert_fee()
{
if( fee_asset->get_id() != asset_id_type() )
{
db().modify(*fee_asset_dyn_data, [this](asset_dynamic_data_object& d) {
d.accumulated_fees += fee_from_account.amount;
d.fee_pool -= core_fee_paid;
});
if( !trx_state->skip_fee ) {
if( fee_asset->get_id() != asset_id_type() )
{
db().modify(*fee_asset_dyn_data, [this](asset_dynamic_data_object& d) {
d.accumulated_fees += fee_from_account.amount;
d.fee_pool -= core_fee_paid;
});
}
}
return;
}
void generic_evaluator::pay_fee()
{ try {
database& d = db();
/// TODO: db().pay_fee( account_id, core_fee );
d.modify(*fee_paying_account_statistics, [&](account_statistics_object& s)
{
s.pay_fee( core_fee_paid, d.get_global_properties().parameters.cashback_vesting_threshold );
});
if( !trx_state->skip_fee ) {
database& d = db();
/// TODO: db().pay_fee( account_id, core_fee );
d.modify(*fee_paying_account_statistics, [&](account_statistics_object& s)
{
s.pay_fee( core_fee_paid, d.get_global_properties().parameters.cashback_vesting_threshold );
});
}
} FC_CAPTURE_AND_RETHROW() }
} }

View file

@ -42,5 +42,6 @@ namespace graphene { namespace chain {
const signed_transaction* _trx = nullptr;
database* _db = nullptr;
bool _is_proposed_trx = false;
bool skip_fee = false;
};
} } // namespace graphene::chain