Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block_time and is_virtual fields to operation_history_object #2642

Merged
merged 5 commits into from
Oct 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add tests for block_time and is_virtual fields
  • Loading branch information
abitmore committed Sep 16, 2022
commit d07cb031dace12875f827abaab1bc78f615839a2
34 changes: 34 additions & 0 deletions tests/tests/history_api_tests.cpp
Original file line number Diff line number Diff line change
@@ -61,6 +61,8 @@ BOOST_AUTO_TEST_CASE(get_account_history) {
BOOST_CHECK_EQUAL(histories.size(), 3u);
BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u);
BOOST_CHECK_EQUAL(histories[2].op.which(), asset_create_op_id);
BOOST_CHECK( histories[2].block_time == db.head_block_time() );
BOOST_CHECK( !histories[2].is_virtual );

// 1 account_create op larger than id1
histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1),
@@ -100,6 +102,38 @@ BOOST_AUTO_TEST_CASE(get_account_history) {
}
}

BOOST_AUTO_TEST_CASE(get_account_history_virtual_operation_test) {
try {
graphene::app::history_api hist_api(app);

asset_id_type usd_id = create_user_issued_asset("USD").id;

ACTORS( (dan)(bob) );
fund( dan, asset(100) );
issue_uia( bob_id, asset(100, usd_id) );

create_sell_order( dan_id, asset(100), asset(100, usd_id) );
create_sell_order( bob_id, asset(100, usd_id), asset(100) );

generate_block();
fc::usleep(fc::milliseconds(200));

auto fill_order_op_id = operation::tag<fill_order_operation>::value;

vector<operation_history_object> histories = hist_api.get_account_history("dan", operation_history_id_type(),
100, operation_history_id_type());

BOOST_REQUIRE_GT( histories.size(), 0 );
BOOST_CHECK_EQUAL( histories.front().op.which(), fill_order_op_id );
BOOST_CHECK( histories.front().block_time == db.head_block_time() );
BOOST_CHECK( histories.front().is_virtual );

} catch (fc::exception &e) {
edump((e.to_detail_string()));
throw;
}
}

BOOST_AUTO_TEST_CASE(get_account_history_notify_all_on_creation) {
try {
// Pass hard fork time