未验证 提交 64e0246a 编写于 作者: D Daniel Larimer 提交者: GitHub

Merge pull request #1911 from EOSIO/deferred-transactions-3

Schedule deferred transactions
...@@ -59,9 +59,9 @@ extern "C" { ...@@ -59,9 +59,9 @@ extern "C" {
* @{ * @{
*/ */
void send_deferred(uint64_t sender_id, time delay_until, char *serialized_transaction, size_t size); void send_deferred(const uint128_t& sender_id, time delay_until, char *serialized_transaction, size_t size);
void cancel_deferred(uint64_t sender_id); void cancel_deferred(const uint128_t& sender_id);
/** /**
* access a copy of the currently executing transaction * access a copy of the currently executing transaction
......
...@@ -48,7 +48,7 @@ namespace eosio { ...@@ -48,7 +48,7 @@ namespace eosio {
class deferred_transaction : public transaction { class deferred_transaction : public transaction {
public: public:
uint64_t sender_id; uint128_t sender_id;
account_name sender; account_name sender;
time delay_until; time delay_until;
......
...@@ -251,7 +251,7 @@ void apply_context::execute_deferred( deferred_transaction&& trx ) { ...@@ -251,7 +251,7 @@ void apply_context::execute_deferred( deferred_transaction&& trx ) {
} FC_CAPTURE_AND_RETHROW((trx)); } FC_CAPTURE_AND_RETHROW((trx));
} }
void apply_context::cancel_deferred( uint64_t sender_id ) { void apply_context::cancel_deferred( uint128_t sender_id ) {
results.deferred_transaction_requests.push_back(deferred_reference(receiver, sender_id)); results.deferred_transaction_requests.push_back(deferred_reference(receiver, sender_id));
} }
......
...@@ -249,13 +249,19 @@ bool chain_controller::_push_block(const signed_block& new_block) ...@@ -249,13 +249,19 @@ bool chain_controller::_push_block(const signed_block& new_block)
* queues. * queues.
*/ */
transaction_trace chain_controller::push_transaction(const packed_transaction& trx, uint32_t skip) transaction_trace chain_controller::push_transaction(const packed_transaction& trx, uint32_t skip)
{ try { { try {
return with_skip_flags(skip, [&]() { // If this is the first transaction pushed after applying a block, start a new undo session.
return _db.with_write_lock([&]() { // This allows us to quickly rewind to the clean state of the head block, in case a new block arrives.
return _push_transaction(trx); if( !_pending_block ) {
}); _start_pending_block();
}); }
} EOS_CAPTURE_AND_RETHROW( transaction_exception ) }
return with_skip_flags(skip, [&]() {
return _db.with_write_lock([&]() {
return _push_transaction(trx);
});
});
} EOS_CAPTURE_AND_RETHROW( transaction_exception ) }
transaction_trace chain_controller::_push_transaction(const packed_transaction& packed_trx) transaction_trace chain_controller::_push_transaction(const packed_transaction& packed_trx)
{ try { { try {
...@@ -324,18 +330,16 @@ static void record_locks_for_data_access(const vector<action_trace>& action_trac ...@@ -324,18 +330,16 @@ static void record_locks_for_data_access(const vector<action_trace>& action_trac
transaction_trace chain_controller::_push_transaction( transaction_metadata&& data ) transaction_trace chain_controller::_push_transaction( transaction_metadata&& data )
{ try { { try {
FC_ASSERT( _pending_block, " block not started" );
if (_limits.max_push_transaction_us.count() > 0) { if (_limits.max_push_transaction_us.count() > 0) {
data.processing_deadline = fc::time_point::now() + _limits.max_push_transaction_us; auto newval = fc::time_point::now() + _limits.max_push_transaction_us;
if ( !data.processing_deadline || newval < *data.processing_deadline ) {
data.processing_deadline = newval;
}
} }
const transaction& trx = data.trx(); const transaction& trx = data.trx();
// If this is the first transaction pushed after applying a block, start a new undo session.
// This allows us to quickly rewind to the clean state of the head block, in case a new block arrives.
if( !_pending_block ) {
_start_pending_block();
}
auto temp_session = _db.start_undo_session(true); auto temp_session = _db.start_undo_session(true);
// for now apply the transaction serially but schedule it according to those invariants // for now apply the transaction serially but schedule it according to those invariants
...@@ -383,7 +387,7 @@ block_header chain_controller::head_block_header() const ...@@ -383,7 +387,7 @@ block_header chain_controller::head_block_header() const
return block_header(); return block_header();
} }
void chain_controller::_start_pending_block() void chain_controller::_start_pending_block( bool skip_deferred )
{ {
FC_ASSERT( !_pending_block ); FC_ASSERT( !_pending_block );
_pending_block = signed_block(); _pending_block = signed_block();
...@@ -391,10 +395,20 @@ void chain_controller::_start_pending_block() ...@@ -391,10 +395,20 @@ void chain_controller::_start_pending_block()
_pending_block_session = _db.start_undo_session(true); _pending_block_session = _db.start_undo_session(true);
_pending_block->regions.resize(1); _pending_block->regions.resize(1);
_pending_block_trace->region_traces.resize(1); _pending_block_trace->region_traces.resize(1);
_start_pending_cycle(); _start_pending_cycle();
_apply_on_block_transaction(); _apply_on_block_transaction();
_finalize_pending_cycle(); _finalize_pending_cycle();
_start_pending_cycle(); _start_pending_cycle();
if ( !skip_deferred ) {
_push_deferred_transactions( false );
if (_pending_cycle_trace && _pending_cycle_trace->shard_traces.size() > 0 && _pending_cycle_trace->shard_traces.back().transaction_traces.size() > 0) {
_finalize_pending_cycle();
_start_pending_cycle();
}
}
} }
transaction chain_controller::_get_on_block_transaction() transaction chain_controller::_get_on_block_transaction()
...@@ -764,6 +778,7 @@ void chain_controller::__apply_block(const signed_block& next_block) ...@@ -764,6 +778,7 @@ void chain_controller::__apply_block(const signed_block& next_block)
const auto* gtrx = _db.find<generated_transaction_object,by_trx_id>(receipt.id); const auto* gtrx = _db.find<generated_transaction_object,by_trx_id>(receipt.id);
if (gtrx != nullptr) { if (gtrx != nullptr) {
auto trx = fc::raw::unpack<deferred_transaction>(gtrx->packed_trx.data(), gtrx->packed_trx.size()); auto trx = fc::raw::unpack<deferred_transaction>(gtrx->packed_trx.data(), gtrx->packed_trx.size());
FC_ASSERT( trx.execute_after <= head_block_time() , "deffered transaction executed prematurely" );
_temp.emplace(trx, gtrx->published, trx.sender, trx.sender_id, gtrx->packed_trx.data(), gtrx->packed_trx.size() ); _temp.emplace(trx, gtrx->published, trx.sender, trx.sender_id, gtrx->packed_trx.data(), gtrx->packed_trx.size() );
return &*_temp; return &*_temp;
} else { } else {
...@@ -1726,8 +1741,23 @@ transaction_trace chain_controller::_apply_error( transaction_metadata& meta ) { ...@@ -1726,8 +1741,23 @@ transaction_trace chain_controller::_apply_error( transaction_metadata& meta ) {
return result; return result;
} }
vector<transaction_trace> chain_controller::push_deferred_transactions( bool flush ) vector<transaction_trace> chain_controller::push_deferred_transactions( bool flush, uint32_t skip )
{ try {
if( !_pending_block ) {
_start_pending_block( true );
}
return with_skip_flags(skip, [&]() {
return _db.with_write_lock([&]() {
return _push_deferred_transactions( flush );
});
});
} FC_CAPTURE_AND_RETHROW() }
vector<transaction_trace> chain_controller::_push_deferred_transactions( bool flush )
{ {
FC_ASSERT( _pending_block, " block not started" );
if (flush && _pending_cycle_trace && _pending_cycle_trace->shard_traces.size() > 0) { if (flush && _pending_cycle_trace && _pending_cycle_trace->shard_traces.size() > 0) {
// TODO: when we go multithreaded this will need a better way to see if there are flushable // TODO: when we go multithreaded this will need a better way to see if there are flushable
// deferred transactions in the shards // deferred transactions in the shards
...@@ -1761,18 +1791,22 @@ vector<transaction_trace> chain_controller::push_deferred_transactions( bool flu ...@@ -1761,18 +1791,22 @@ vector<transaction_trace> chain_controller::push_deferred_transactions( bool flu
candidates.emplace_back(&gtrx); candidates.emplace_back(&gtrx);
} }
auto deferred_transactions_deadline = fc::time_point::now() + fc::microseconds(config::deffered_transactions_max_time_per_block_us);
vector<transaction_trace> res; vector<transaction_trace> res;
for (const auto* trx_p: candidates) { for (const auto* trx_p: candidates) {
if (!is_known_transaction(trx_p->trx_id)) { if (!is_known_transaction(trx_p->trx_id)) {
try { try {
auto trx = fc::raw::unpack<deferred_transaction>(trx_p->packed_trx.data(), trx_p->packed_trx.size()); auto trx = fc::raw::unpack<deferred_transaction>(trx_p->packed_trx.data(), trx_p->packed_trx.size());
transaction_metadata mtrx (trx, trx_p->published, trx.sender, trx.sender_id, trx_p->packed_trx.data(), trx_p->packed_trx.size()); transaction_metadata mtrx (trx, trx_p->published, trx.sender, trx.sender_id, trx_p->packed_trx.data(), trx_p->packed_trx.size(), deferred_transactions_deadline);
res.push_back( _push_transaction(std::move(mtrx)) ); res.push_back( _push_transaction(std::move(mtrx)) );
generated_transaction_idx.remove(*trx_p); generated_transaction_idx.remove(*trx_p);
} FC_CAPTURE_AND_LOG((trx_p->trx_id)(trx_p->sender)); } FC_CAPTURE_AND_LOG((trx_p->trx_id)(trx_p->sender));
} else { } else {
generated_transaction_idx.remove(*trx_p); generated_transaction_idx.remove(*trx_p);
} }
if ( deferred_transactions_deadline <= fc::time_point::now() ) {
break;
}
} }
return res; return res;
} }
......
...@@ -464,7 +464,7 @@ class apply_context { ...@@ -464,7 +464,7 @@ class apply_context {
void execute_inline( action &&a ); void execute_inline( action &&a );
void execute_context_free_inline( action &&a ); void execute_context_free_inline( action &&a );
void execute_deferred( deferred_transaction &&trx ); void execute_deferred( deferred_transaction &&trx );
void cancel_deferred( uint64_t sender_id ); void cancel_deferred( uint128_t sender_id );
/** /**
* @brief Require @ref account to have approved of this message * @brief Require @ref account to have approved of this message
......
...@@ -87,8 +87,7 @@ namespace eosio { namespace chain { ...@@ -87,8 +87,7 @@ namespace eosio { namespace chain {
void push_block( const signed_block& b, uint32_t skip = skip_nothing ); void push_block( const signed_block& b, uint32_t skip = skip_nothing );
transaction_trace push_transaction( const packed_transaction& trx, uint32_t skip = skip_nothing ); transaction_trace push_transaction( const packed_transaction& trx, uint32_t skip = skip_nothing );
vector<transaction_trace> push_deferred_transactions( bool flush = false ); vector<transaction_trace> push_deferred_transactions( bool flush = false, uint32_t skip = skip_nothing );
/** /**
...@@ -316,6 +315,7 @@ namespace eosio { namespace chain { ...@@ -316,6 +315,7 @@ namespace eosio { namespace chain {
transaction_trace _apply_transaction( transaction_metadata& data ); transaction_trace _apply_transaction( transaction_metadata& data );
transaction_trace __apply_transaction( transaction_metadata& data ); transaction_trace __apply_transaction( transaction_metadata& data );
transaction_trace _apply_error( transaction_metadata& data ); transaction_trace _apply_error( transaction_metadata& data );
vector<transaction_trace> _push_deferred_transactions( bool flush = false );
/// Reset the object graph in-memory /// Reset the object graph in-memory
void _initialize_indexes(); void _initialize_indexes();
...@@ -414,7 +414,7 @@ namespace eosio { namespace chain { ...@@ -414,7 +414,7 @@ namespace eosio { namespace chain {
void _spinup_db(); void _spinup_db();
void _spinup_fork_db(); void _spinup_fork_db();
void _start_pending_block(); void _start_pending_block( bool skip_deferred = false );
void _start_pending_cycle(); void _start_pending_cycle();
void _start_pending_shard(); void _start_pending_shard();
void _finalize_pending_cycle(); void _finalize_pending_cycle();
......
...@@ -72,6 +72,11 @@ const static eosio::chain::wasm_interface::vm_type default_wasm_runtime = eosio: ...@@ -72,6 +72,11 @@ const static eosio::chain::wasm_interface::vm_type default_wasm_runtime = eosio:
*/ */
const static int producer_repetitions = 12; const static int producer_repetitions = 12;
/**
* In block production, at the begining of each block we schedule deferred transactions until reach this time
*/
const static uint32_t deffered_transactions_max_time_per_block_us = 20*1000; //20ms
/** /**
* The number of blocks produced per round is based upon all producers having a chance * The number of blocks produced per round is based upon all producers having a chance
* to produce all of their consecutive blocks. * to produce all of their consecutive blocks.
......
...@@ -29,7 +29,7 @@ namespace eosio { namespace chain { ...@@ -29,7 +29,7 @@ namespace eosio { namespace chain {
id_type id; id_type id;
transaction_id_type trx_id; transaction_id_type trx_id;
account_name sender; account_name sender;
uint64_t sender_id = 0; /// ID given this transaction by the sender uint128_t sender_id = 0; /// ID given this transaction by the sender
time_point delay_until; /// this generated transaction will not be applied until the specified time time_point delay_until; /// this generated transaction will not be applied until the specified time
time_point expiration; /// this generated transaction will not be applied after this time time_point expiration; /// this generated transaction will not be applied after this time
time_point published; time_point published;
...@@ -62,7 +62,7 @@ namespace eosio { namespace chain { ...@@ -62,7 +62,7 @@ namespace eosio { namespace chain {
ordered_unique< tag<by_sender_id>, ordered_unique< tag<by_sender_id>,
composite_key< generated_transaction_object, composite_key< generated_transaction_object,
BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, account_name, sender), BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, account_name, sender),
BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, uint64_t, sender_id) BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, uint128_t, sender_id)
> >
> >
> >
......
...@@ -214,13 +214,13 @@ namespace eosio { namespace chain { ...@@ -214,13 +214,13 @@ namespace eosio { namespace chain {
*/ */
struct deferred_transaction : public transaction struct deferred_transaction : public transaction
{ {
uint64_t sender_id; /// ID assigned by sender of generated, accessible via WASM api when executing normal or error uint128_t sender_id; /// ID assigned by sender of generated, accessible via WASM api when executing normal or error
account_name sender; /// receives error handler callback account_name sender; /// receives error handler callback
time_point_sec execute_after; /// delayed exeuction time_point_sec execute_after; /// delayed exeuction
deferred_transaction() = default; deferred_transaction() = default;
deferred_transaction(uint32_t sender_id, account_name sender, time_point_sec execute_after, const transaction& txn) deferred_transaction(uint128_t sender_id, account_name sender, time_point_sec execute_after, const transaction& txn)
: transaction(txn), : transaction(txn),
sender_id(sender_id), sender_id(sender_id),
sender(sender), sender(sender),
...@@ -229,12 +229,12 @@ namespace eosio { namespace chain { ...@@ -229,12 +229,12 @@ namespace eosio { namespace chain {
}; };
struct deferred_reference { struct deferred_reference {
deferred_reference( const account_name& sender, uint64_t sender_id) deferred_reference( const account_name& sender, uint128_t sender_id)
:sender(sender),sender_id(sender_id) :sender(sender),sender_id(sender_id)
{} {}
account_name sender; account_name sender;
uint64_t sender_id; uint128_t sender_id;
}; };
struct data_access_info { struct data_access_info {
......
...@@ -16,6 +16,14 @@ class transaction_metadata { ...@@ -16,6 +16,14 @@ class transaction_metadata {
,sender(sender),sender_id(sender_id),raw_data(raw_data),raw_size(raw_size),_trx(&t) ,sender(sender),sender_id(sender_id),raw_data(raw_data),raw_size(raw_size),_trx(&t)
{} {}
transaction_metadata( const transaction& t, const time_point& published, const account_name& sender, uint32_t sender_id, const char* raw_data, size_t raw_size, fc::time_point deadline )
:id(t.id())
,published(published)
,sender(sender),sender_id(sender_id),raw_data(raw_data),raw_size(raw_size)
,processing_deadline(deadline)
,_trx(&t)
{}
transaction_metadata( const packed_transaction& t, chain_id_type chainid, const time_point& published ); transaction_metadata( const packed_transaction& t, chain_id_type chainid, const time_point& published );
transaction_metadata( transaction_metadata && ) = default; transaction_metadata( transaction_metadata && ) = default;
...@@ -39,7 +47,7 @@ class transaction_metadata { ...@@ -39,7 +47,7 @@ class transaction_metadata {
// things for processing deferred transactions // things for processing deferred transactions
optional<account_name> sender; optional<account_name> sender;
uint32_t sender_id = 0; uint128_t sender_id = 0;
// packed form to pass to contracts if needed // packed form to pass to contracts if needed
const char* raw_data = nullptr; const char* raw_data = nullptr;
......
...@@ -1030,23 +1030,24 @@ class transaction_api : public context_aware_api { ...@@ -1030,23 +1030,24 @@ class transaction_api : public context_aware_api {
context.execute_context_free_inline(std::move(act)); context.execute_context_free_inline(std::move(act));
} }
void send_deferred( uint64_t sender_id, const fc::time_point_sec& execute_after, array_ptr<char> data, size_t data_len ) { void send_deferred( const unsigned __int128& val, const fc::time_point_sec& execute_after, array_ptr<char> data, size_t data_len ) {
try { try {
// TODO: use global properties object for dynamic configuration of this default_max_gen_trx_size fc::uint128_t sender_id(val>>64, uint64_t(val) );
const auto& gpo = context.controller.get_global_properties(); const auto& gpo = context.controller.get_global_properties();
FC_ASSERT(data_len < gpo.configuration.max_generated_transaction_size, "generated transaction too big"); FC_ASSERT(data_len < gpo.configuration.max_generated_transaction_size, "generated transaction too big");
deferred_transaction dtrx; deferred_transaction dtrx;
fc::raw::unpack<transaction>(data, data_len, dtrx); fc::raw::unpack<transaction>(data, data_len, dtrx);
dtrx.sender = context.receiver; dtrx.sender = context.receiver;
dtrx.sender_id = sender_id; dtrx.sender_id = (unsigned __int128)sender_id;
dtrx.execute_after = execute_after; dtrx.execute_after = execute_after;
context.execute_deferred(std::move(dtrx)); context.execute_deferred(std::move(dtrx));
} FC_CAPTURE_AND_RETHROW((fc::to_hex(data, data_len))); } FC_CAPTURE_AND_RETHROW((fc::to_hex(data, data_len)));
} }
void cancel_deferred( uint64_t sender_id ) { void cancel_deferred( const unsigned __int128& val ) {
context.cancel_deferred( sender_id ); fc::uint128_t sender_id(val>>64, uint64_t(val) );
context.cancel_deferred( (unsigned __int128)sender_id );
} }
}; };
...@@ -1553,8 +1554,8 @@ REGISTER_INTRINSICS(context_free_transaction_api, ...@@ -1553,8 +1554,8 @@ REGISTER_INTRINSICS(context_free_transaction_api,
REGISTER_INTRINSICS(transaction_api, REGISTER_INTRINSICS(transaction_api,
(send_inline, void(int, int) ) (send_inline, void(int, int) )
(send_context_free_inline, void(int, int) ) (send_context_free_inline, void(int, int) )
(send_deferred, void(int64_t, int, int, int) ) (send_deferred, void(int, int, int, int) )
(cancel_deferred, void(int64_t) ) (cancel_deferred, void(int) )
); );
REGISTER_INTRINSICS(context_free_api, REGISTER_INTRINSICS(context_free_api,
......
...@@ -195,8 +195,8 @@ class static_variant { ...@@ -195,8 +195,8 @@ class static_variant {
static_assert(impl::type_info<Types...>::no_reference_types, "Reference types are not permitted in static_variant."); static_assert(impl::type_info<Types...>::no_reference_types, "Reference types are not permitted in static_variant.");
static_assert(impl::type_info<Types...>::no_duplicates, "static_variant type arguments contain duplicate types."); static_assert(impl::type_info<Types...>::no_duplicates, "static_variant type arguments contain duplicate types.");
alignas(Types...) char storage[impl::type_info<Types...>::size];
int _tag; int _tag;
char storage[impl::type_info<Types...>::size];
template<typename X> template<typename X>
void init(const X& x) { void init(const X& x) {
......
...@@ -376,8 +376,12 @@ namespace fc ...@@ -376,8 +376,12 @@ namespace fc
void to_variant( const uint128& var, variant& vo ) { vo = std::string(var); } void to_variant( const uint128& var, variant& vo ) { vo = std::string(var); }
void from_variant( const variant& var, uint128& vo ){ vo = uint128(var.as_string()); } void from_variant( const variant& var, uint128& vo ){ vo = uint128(var.as_string()); }
void to_variant( const unsigned __int128& var, variant& vo ) { to_variant( *((uint128*)var), vo); } void to_variant( const unsigned __int128& var, variant& vo ) { to_variant( uint128(var), vo); }
void from_variant( const variant& var, unsigned __int128& vo ) { from_variant( var, *((uint128*)&vo)); } void from_variant( const variant& var, unsigned __int128& vo ) {
uint128 tmp;
from_variant( var, tmp );
vo = (unsigned __int128)tmp;
}
} // namespace fc } // namespace fc
......
...@@ -363,7 +363,7 @@ BOOST_FIXTURE_TEST_CASE(action_tests, tester) { try { ...@@ -363,7 +363,7 @@ BOOST_FIXTURE_TEST_CASE(action_tests, tester) { try {
// test send_action_sender // test send_action_sender
CALL_TEST_FUNCTION( *this, "test_transaction", "send_action_sender", fc::raw::pack(N(testapi))); CALL_TEST_FUNCTION( *this, "test_transaction", "send_action_sender", fc::raw::pack(N(testapi)));
control->push_deferred_transactions( true ); produce_block();
// test_publication_time // test_publication_time
uint32_t pub_time = control->head_block_time().sec_since_epoch(); uint32_t pub_time = control->head_block_time().sec_since_epoch();
...@@ -662,11 +662,11 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, tester) { try { ...@@ -662,11 +662,11 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, tester) { try {
produce_blocks(1); produce_blocks(1);
//schedule //schedule
CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", fc::raw::pack(uint64_t(1)) ); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {} );
//check that it doesn't get executed immediately //check that it doesn't get executed immediately
auto traces = control->push_deferred_transactions( true ); auto traces = control->push_deferred_transactions( true );
BOOST_CHECK_EQUAL( 0, traces.size() ); BOOST_CHECK_EQUAL( 0, traces.size() );
produce_blocks(24); produce_block( fc::seconds(2) );
//check that it gets executed afterwards //check that it gets executed afterwards
traces = control->push_deferred_transactions( true ); traces = control->push_deferred_transactions( true );
BOOST_CHECK_EQUAL( 1, traces.size() ); BOOST_CHECK_EQUAL( 1, traces.size() );
...@@ -674,7 +674,7 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, tester) { try { ...@@ -674,7 +674,7 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, tester) { try {
//schedule twice (second deferred transaction should replace first one) //schedule twice (second deferred transaction should replace first one)
CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {});
CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {});
produce_blocks( 24 ); produce_block( fc::seconds(2) );
//check that only one deferred transaction executed //check that only one deferred transaction executed
traces = control->push_deferred_transactions( true ); traces = control->push_deferred_transactions( true );
BOOST_CHECK_EQUAL( 1, traces.size() ); BOOST_CHECK_EQUAL( 1, traces.size() );
...@@ -682,14 +682,14 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, tester) { try { ...@@ -682,14 +682,14 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, tester) { try {
//schedule and cancel //schedule and cancel
CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {});
CALL_TEST_FUNCTION(*this, "test_transaction", "cancel_deferred_transaction", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "cancel_deferred_transaction", {});
produce_blocks( 24 ); produce_block( fc::seconds(2) );
traces = control->push_deferred_transactions( true ); traces = control->push_deferred_transactions( true );
BOOST_CHECK_EQUAL( 0, traces.size() ); BOOST_CHECK_EQUAL( 0, traces.size() );
//cancel_deferred() before scheduling transaction should not prevent the transaction from being scheduled (check that previous bug is fixed) //cancel_deferred() before scheduling transaction should not prevent the transaction from being scheduled (check that previous bug is fixed)
CALL_TEST_FUNCTION(*this, "test_transaction", "cancel_deferred_transaction", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "cancel_deferred_transaction", {});
CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {});
produce_blocks( 24 ); produce_block( fc::seconds(2) );
traces = control->push_deferred_transactions( true ); traces = control->push_deferred_transactions( true );
BOOST_CHECK_EQUAL( 1, traces.size() ); BOOST_CHECK_EQUAL( 1, traces.size() );
} FC_LOG_AND_RETHROW() } } FC_LOG_AND_RETHROW() }
......
...@@ -128,8 +128,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { ...@@ -128,8 +128,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -137,8 +135,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { ...@@ -137,8 +135,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(18); chain.produce_blocks(18);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -146,8 +142,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { ...@@ -146,8 +142,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -155,8 +149,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { ...@@ -155,8 +149,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -276,8 +268,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { ...@@ -276,8 +268,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -285,8 +275,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { ...@@ -285,8 +275,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(28); chain.produce_blocks(28);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -294,8 +282,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { ...@@ -294,8 +282,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -303,8 +289,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { ...@@ -303,8 +289,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -430,8 +414,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { ...@@ -430,8 +414,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -439,8 +421,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { ...@@ -439,8 +421,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(38); chain.produce_blocks(38);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -448,8 +428,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { ...@@ -448,8 +428,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -457,8 +435,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { ...@@ -457,8 +435,6 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -573,8 +549,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ...@@ -573,8 +549,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(16); chain.produce_blocks(16);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -601,8 +575,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ...@@ -601,8 +575,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -611,8 +583,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ...@@ -611,8 +583,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
// first transfer will finally be performed // first transfer will finally be performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -630,8 +600,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ...@@ -630,8 +600,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try {
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status);
BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size()); BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size());
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -639,8 +607,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ...@@ -639,8 +607,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(15); chain.produce_blocks(15);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -648,8 +614,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ...@@ -648,8 +614,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -658,8 +622,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ...@@ -658,8 +622,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
// second transfer finally is performed // second transfer finally is performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -780,8 +742,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ...@@ -780,8 +742,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(16); chain.produce_blocks(16);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -808,8 +768,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ...@@ -808,8 +768,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -818,8 +776,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ...@@ -818,8 +776,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) {
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
// first transfer will finally be performed // first transfer will finally be performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -837,8 +793,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ...@@ -837,8 +793,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) {
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status);
BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size()); BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size());
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -846,8 +800,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ...@@ -846,8 +800,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(15); chain.produce_blocks(15);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -855,8 +807,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ...@@ -855,8 +807,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -865,8 +815,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ...@@ -865,8 +815,6 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) {
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
// second transfer finally is performed // second transfer finally is performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -986,8 +934,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ...@@ -986,8 +934,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(16); chain.produce_blocks(16);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1014,8 +960,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ...@@ -1014,8 +960,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1024,8 +968,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ...@@ -1024,8 +968,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
// first transfer will finally be performed // first transfer will finally be performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1043,8 +985,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ...@@ -1043,8 +985,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try {
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status);
BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size()); BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size());
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1052,8 +992,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ...@@ -1052,8 +992,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(15); chain.produce_blocks(15);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1061,8 +999,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ...@@ -1061,8 +999,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1071,8 +1007,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ...@@ -1071,8 +1007,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
// second transfer finally is performed // second transfer finally is performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1198,8 +1132,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ...@@ -1198,8 +1132,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(16); chain.produce_blocks(16);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1226,8 +1158,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ...@@ -1226,8 +1158,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1236,8 +1166,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ...@@ -1236,8 +1166,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
// first transfer will finally be performed // first transfer will finally be performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1255,8 +1183,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ...@@ -1255,8 +1183,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try {
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status);
BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size()); BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size());
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1264,8 +1190,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ...@@ -1264,8 +1190,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(15); chain.produce_blocks(15);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1273,8 +1197,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ...@@ -1273,8 +1197,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1283,8 +1205,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ...@@ -1283,8 +1205,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance);
// second transfer finally is performed // second transfer finally is performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1400,8 +1320,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { ...@@ -1400,8 +1320,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1409,8 +1327,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { ...@@ -1409,8 +1327,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(18); chain.produce_blocks(18);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1418,8 +1334,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { ...@@ -1418,8 +1334,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1427,8 +1341,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { ...@@ -1427,8 +1341,6 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1543,8 +1455,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ...@@ -1543,8 +1455,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(16); chain.produce_blocks(16);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1582,9 +1492,7 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ...@@ -1582,9 +1492,7 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try {
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status);
BOOST_REQUIRE_EQUAL(1, trace.deferred_transaction_requests.size()); BOOST_REQUIRE_EQUAL(1, trace.deferred_transaction_requests.size());
const auto sender_id_canceled = trace.deferred_transaction_requests[0].get<deferred_reference>().sender_id; const auto sender_id_canceled = trace.deferred_transaction_requests[0].get<deferred_reference>().sender_id;
BOOST_REQUIRE_EQUAL(sender_id_to_cancel, sender_id_canceled); BOOST_REQUIRE_EQUAL(std::string(uint128(sender_id_to_cancel)), std::string(uint128(sender_id_canceled)));
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
...@@ -1594,8 +1502,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ...@@ -1594,8 +1502,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance);
// first transfer will finally be performed // first transfer will finally be performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1613,8 +1519,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ...@@ -1613,8 +1519,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try {
BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace.status);
BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size()); BOOST_REQUIRE_EQUAL(0, trace.deferred_transaction_requests.size());
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1622,8 +1526,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ...@@ -1622,8 +1526,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(15); chain.produce_blocks(15);
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1631,8 +1533,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ...@@ -1631,8 +1533,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try {
liquid_balance = get_currency_balance(chain, N(tester2)); liquid_balance = get_currency_balance(chain, N(tester2));
BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance);
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
...@@ -1641,8 +1541,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ...@@ -1641,8 +1541,6 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try {
BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance); BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance);
// second transfer finally is performed // second transfer finally is performed
chain.control->push_deferred_transactions(true);
chain.produce_blocks(); chain.produce_blocks();
liquid_balance = get_currency_balance(chain, N(tester)); liquid_balance = get_currency_balance(chain, N(tester));
......
...@@ -402,13 +402,12 @@ BOOST_FIXTURE_TEST_CASE( test_proxy, currency_tester ) try { ...@@ -402,13 +402,12 @@ BOOST_FIXTURE_TEST_CASE( test_proxy, currency_tester ) try {
} }
while(control->head_block_time() < expected_delivery) { while(control->head_block_time() < expected_delivery) {
control->push_deferred_transactions(true);
produce_block(); produce_block();
BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("0.0000 CUR"));
} }
control->push_deferred_transactions(true); produce_block();
BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("5.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("5.0000 CUR"));
...@@ -459,7 +458,6 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { ...@@ -459,7 +458,6 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try {
auto deferred_id = trace.deferred_transaction_requests.back().get<deferred_transaction>().id(); auto deferred_id = trace.deferred_transaction_requests.back().get<deferred_transaction>().id();
while(control->head_block_time() < expected_delivery) { while(control->head_block_time() < expected_delivery) {
control->push_deferred_transactions(true);
produce_block(); produce_block();
BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR"));
...@@ -468,7 +466,6 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { ...@@ -468,7 +466,6 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try {
} }
fc::time_point expected_redelivery(fc::seconds(control->head_block_time().sec_since_epoch()) + fc::seconds(10)); fc::time_point expected_redelivery(fc::seconds(control->head_block_time().sec_since_epoch()) + fc::seconds(10));
control->push_deferred_transactions(true);
produce_block(); produce_block();
BOOST_REQUIRE_EQUAL(chain_has_transaction(deferred_id), true); BOOST_REQUIRE_EQUAL(chain_has_transaction(deferred_id), true);
BOOST_REQUIRE_EQUAL(get_transaction_receipt(deferred_id).status, transaction_receipt::soft_fail); BOOST_REQUIRE_EQUAL(get_transaction_receipt(deferred_id).status, transaction_receipt::soft_fail);
...@@ -494,19 +491,18 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { ...@@ -494,19 +491,18 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try {
} }
while(control->head_block_time() < expected_redelivery) { while(control->head_block_time() < expected_redelivery) {
control->push_deferred_transactions(true);
produce_block(); produce_block();
BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR"));
} }
control->push_deferred_transactions(true); produce_block();
BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("0.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("5.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("5.0000 CUR"));
control->push_deferred_transactions(true); produce_block();
BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR"));
BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("5.0000 CUR")); BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("5.0000 CUR"));
......
...@@ -207,17 +207,16 @@ BOOST_FIXTURE_TEST_CASE( stake_unstake, eosio_system_tester ) try { ...@@ -207,17 +207,16 @@ BOOST_FIXTURE_TEST_CASE( stake_unstake, eosio_system_tester ) try {
BOOST_REQUIRE_EQUAL( asset::from_string("0.0000 EOS").amount, total["storage_stake"].as_uint64()); BOOST_REQUIRE_EQUAL( asset::from_string("0.0000 EOS").amount, total["storage_stake"].as_uint64());
BOOST_REQUIRE_EQUAL( 0, total["storage_bytes"].as_uint64()); BOOST_REQUIRE_EQUAL( 0, total["storage_bytes"].as_uint64());
REQUIRE_MATCHING_OBJECT( voter( "alice", "0.00 EOS" ), get_voter_info( "alice" ) ); REQUIRE_MATCHING_OBJECT( voter( "alice", "0.00 EOS" ), get_voter_info( "alice" ) );
control->push_deferred_transactions(true); produce_blocks(1);
BOOST_REQUIRE_EQUAL( asset::from_string("200.0000 EOS"), get_balance( "alice" ) ); BOOST_REQUIRE_EQUAL( asset::from_string("200.0000 EOS"), get_balance( "alice" ) );
//after 2 days balance should not be available yet //after 2 days balance should not be available yet
produce_block( fc::hours(3*24-1) ); produce_block( fc::hours(3*24-1) );
control->push_deferred_transactions(true); produce_blocks(1);
BOOST_REQUIRE_EQUAL( asset::from_string("200.0000 EOS"), get_balance( "alice" ) ); BOOST_REQUIRE_EQUAL( asset::from_string("200.0000 EOS"), get_balance( "alice" ) );
//after 3 days funds should be released //after 3 days funds should be released
produce_block( fc::hours(1) ); produce_block( fc::hours(1) );
control->push_deferred_transactions(true); produce_blocks(1);
BOOST_REQUIRE_EQUAL( asset::from_string("1000.0000 EOS"), get_balance( "alice" ) ); BOOST_REQUIRE_EQUAL( asset::from_string("1000.0000 EOS"), get_balance( "alice" ) );
} FC_LOG_AND_RETHROW() } FC_LOG_AND_RETHROW()
...@@ -502,10 +501,10 @@ BOOST_FIXTURE_TEST_CASE( adding_stake_partial_unstake, eosio_system_tester ) try ...@@ -502,10 +501,10 @@ BOOST_FIXTURE_TEST_CASE( adding_stake_partial_unstake, eosio_system_tester ) try
//combined amount should be available only in 3 days //combined amount should be available only in 3 days
produce_block( fc::days(2) ); produce_block( fc::days(2) );
control->push_deferred_transactions(true); produce_blocks(1);
BOOST_REQUIRE_EQUAL( asset::from_string("430.0000 EOS"), get_balance( "alice" ) ); BOOST_REQUIRE_EQUAL( asset::from_string("430.0000 EOS"), get_balance( "alice" ) );
produce_block( fc::days(1) ); produce_block( fc::days(1) );
control->push_deferred_transactions(true); produce_blocks(1);
BOOST_REQUIRE_EQUAL( asset::from_string("790.0000 EOS"), get_balance( "alice" ) ); BOOST_REQUIRE_EQUAL( asset::from_string("790.0000 EOS"), get_balance( "alice" ) );
} FC_LOG_AND_RETHROW() } FC_LOG_AND_RETHROW()
...@@ -661,7 +660,7 @@ BOOST_FIXTURE_TEST_CASE( vote_for_producer, eosio_system_tester ) try { ...@@ -661,7 +660,7 @@ BOOST_FIXTURE_TEST_CASE( vote_for_producer, eosio_system_tester ) try {
BOOST_REQUIRE_EQUAL( string(key.begin(), key.end()), to_string(prod["packed_key"]) ); BOOST_REQUIRE_EQUAL( string(key.begin(), key.end()), to_string(prod["packed_key"]) );
//carol should receive funds in 3 days //carol should receive funds in 3 days
produce_block( fc::days(3) ); produce_block( fc::days(3) );
control->push_deferred_transactions(true); produce_block();
BOOST_REQUIRE_EQUAL( asset::from_string("3000.0000 EOS"), get_balance( "carol" ) ); BOOST_REQUIRE_EQUAL( asset::from_string("3000.0000 EOS"), get_balance( "carol" ) );
} FC_LOG_AND_RETHROW() } FC_LOG_AND_RETHROW()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册