diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index c09b4ab3..6e8afd4a 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -567,7 +567,10 @@ processed_transaction database::apply_transaction(const signed_transaction& trx, processed_transaction database::_apply_transaction(const signed_transaction& trx) { try { uint32_t skip = get_node_properties().skip_flags; - trx.validate(); + + if( !(skip&skip_validate) ) + trx.validate(); + auto& trx_idx = get_mutable_index_type(); const chain_id_type& chain_id = get_chain_id(); auto trx_id = trx.id(); diff --git a/libraries/chain/db_update.cpp b/libraries/chain/db_update.cpp index 2b6ba2e7..37c0a5de 100644 --- a/libraries/chain/db_update.cpp +++ b/libraries/chain/db_update.cpp @@ -348,6 +348,12 @@ void database::clear_expired_orders() assert(itr != call_index.end() && itr->debt_type() == mia_object.get_id()); asset max_settlement = max_settlement_volume - settled; + if( order.balance.amount == 0 ) + { + wlog( "0 settlement detected" ); + cancel_order( order ); + break; + } try { settled += match(*itr, order, settlement_price, max_settlement); } diff --git a/libraries/chain/include/graphene/chain/database.hpp b/libraries/chain/include/graphene/chain/database.hpp index 7197d47c..6571ccf6 100644 --- a/libraries/chain/include/graphene/chain/database.hpp +++ b/libraries/chain/include/graphene/chain/database.hpp @@ -70,7 +70,8 @@ namespace graphene { namespace chain { skip_merkle_check = 1 << 7, ///< used while reindexing skip_assert_evaluation = 1 << 8, ///< used while reindexing skip_undo_history_check = 1 << 9, ///< used while reindexing - skip_witness_schedule_check = 1 << 10 ///< used whiel reindexing + skip_witness_schedule_check = 1 << 10, ///< used while reindexing + skip_validate = 1 << 11 ///< used prior to checkpoint, skips validate() call on transaction }; /** diff --git a/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp b/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp index 154c599d..13376053 100644 --- a/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp +++ b/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp @@ -225,7 +225,9 @@ namespace graphene { namespace chain { extensions_type extensions; account_id_type fee_payer()const { return account; } - void validate()const {} + void validate()const { + FC_ASSERT( amount.amount > 0, "Must settle at least 1 unit" ); + } share_type calculate_fee(const fee_parameters_type& params)const { return 0; }