Skip to content

Commit 069d87d

Browse files
committed
Fix test cases due to operation_results changes
1 parent 0cc3513 commit 069d87d

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

tests/cli/main.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc )
16681668
BOOST_CHECK(generate_block(app1, result_block));
16691669

16701670
// get the ID:
1671-
htlc_id_type htlc_id = result_block.transactions[result_block.transactions.size()-1].operation_results[0].get<object_id_type>();
1671+
auto tmp_hist = con.wallet_api_ptr->get_account_history("alice", 1);
1672+
htlc_id_type htlc_id = tmp_hist[0].op.result.get<object_id_type>();
16721673
alice_htlc_id_as_string = (std::string)(object_id_type)htlc_id;
16731674
BOOST_TEST_MESSAGE("Alice shares the HTLC ID with Bob. The HTLC ID is: " + alice_htlc_id_as_string);
16741675
}
@@ -1690,7 +1691,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc )
16901691
BOOST_CHECK(generate_block(app1, result_block));
16911692

16921693
// get the ID:
1693-
htlc_id_type htlc_id = result_block.transactions[result_block.transactions.size()-1].operation_results[0].get<object_id_type>();
1694+
auto tmp_hist = con.wallet_api_ptr->get_account_history("bob", 1);
1695+
htlc_id_type htlc_id = tmp_hist[0].op.result.get<object_id_type>();
16941696
bob_htlc_id_as_string = (std::string)(object_id_type)htlc_id;
16951697
BOOST_TEST_MESSAGE("Bob shares the HTLC ID with Alice. The HTLC ID is: " + bob_htlc_id_as_string);
16961698
}
@@ -2213,8 +2215,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 )
22132215
BOOST_CHECK(generate_block(app1, result_block));
22142216

22152217
// get the ID:
2216-
htlc_id_type htlc_id = result_block.transactions[result_block.transactions.size()-1]
2217-
.operation_results[0].get<object_id_type>();
2218+
auto tmp_hist = con.wallet_api_ptr->get_account_history("alice", 1);
2219+
htlc_id_type htlc_id = tmp_hist[0].op.result.get<object_id_type>();
22182220
alice_htlc_id_as_string = (std::string)(object_id_type)htlc_id;
22192221
BOOST_TEST_MESSAGE("Alice shares the HTLC ID with Bob. The HTLC ID is: " + alice_htlc_id_as_string);
22202222
}
@@ -2237,8 +2239,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 )
22372239
BOOST_CHECK(generate_block(app1, result_block));
22382240

22392241
// get the ID:
2240-
htlc_id_type htlc_id = result_block.transactions[result_block.transactions.size()-1]
2241-
.operation_results[0].get<object_id_type>();
2242+
auto tmp_hist = con.wallet_api_ptr->get_account_history("bob", 1);
2243+
htlc_id_type htlc_id = tmp_hist[0].op.result.get<object_id_type>();
22422244
bob_htlc_id_as_string = (std::string)(object_id_type)htlc_id;
22432245
BOOST_TEST_MESSAGE("Bob shares the HTLC ID with Alice. The HTLC ID is: " + bob_htlc_id_as_string);
22442246
}

tests/tests/htlc_tests.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ try {
103103
create_operation.fee = db.get_global_properties().parameters.current_fees->calculate_fee(create_operation);
104104
trx.operations.push_back(create_operation);
105105
sign(trx, alice_private_key);
106-
PUSH_TX(db, trx, ~0);
106+
processed_transaction alice_trx = PUSH_TX(db, trx, ~0);
107107
trx.clear();
108-
graphene::chain::signed_block blk = generate_block();
109-
processed_transaction alice_trx = blk.transactions[0];
108+
generate_block();
110109
alice_htlc_id = alice_trx.operation_results[0].get<object_id_type>();
111110
generate_block();
112111
}
@@ -553,10 +552,9 @@ try {
553552
create_operation.fee = db.current_fee_schedule().calculate_fee( create_operation );
554553
trx.operations.push_back( create_operation );
555554
sign(trx, alice_private_key);
556-
PUSH_TX(db, trx, ~0);
555+
processed_transaction alice_trx = PUSH_TX(db, trx, ~0);
557556
trx.clear();
558-
graphene::chain::signed_block blk = generate_block();
559-
processed_transaction alice_trx = blk.transactions[0];
557+
generate_block();
560558
alice_htlc_id = alice_trx.operation_results[0].get<object_id_type>();
561559
}
562560

@@ -1053,10 +1051,9 @@ try {
10531051
trx.operations.push_back( create_operation );
10541052
sign(trx, alice_private_key);
10551053
// bob can now accept it, so it works
1056-
PUSH_TX( db, trx, ~0 );
1054+
processed_transaction alice_trx = PUSH_TX( db, trx, ~0 );
10571055
trx.clear();
1058-
graphene::chain::signed_block blk = generate_block();
1059-
processed_transaction alice_trx = blk.transactions[0];
1056+
generate_block();
10601057
alice_htlc_id = alice_trx.operation_results[0].get<object_id_type>();
10611058
}
10621059

@@ -1129,11 +1126,10 @@ try {
11291126
create_operation.fee = db.get_global_properties().parameters.current_fees->calculate_fee(create_operation);
11301127
trx.operations.push_back(create_operation);
11311128
sign(trx, alice_private_key);
1132-
PUSH_TX(db, trx, ~0);
1129+
processed_transaction alice_trx = PUSH_TX(db, trx, ~0);
11331130
trx.clear();
11341131
set_expiration( db, trx );
1135-
graphene::chain::signed_block blk = generate_block();
1136-
processed_transaction alice_trx = blk.transactions[0];
1132+
generate_block();
11371133
alice_htlc_id_bob = alice_trx.operation_results[0].get<object_id_type>();
11381134
generate_block();
11391135
set_expiration( db, trx );
@@ -1153,11 +1149,10 @@ try {
11531149
create_operation.fee = db.get_global_properties().parameters.current_fees->calculate_fee(create_operation);
11541150
trx.operations.push_back(create_operation);
11551151
sign(trx, alice_private_key);
1156-
PUSH_TX(db, trx, ~0);
1152+
processed_transaction alice_trx = PUSH_TX(db, trx, ~0);
11571153
trx.clear();
11581154
set_expiration( db, trx );
1159-
graphene::chain::signed_block blk = generate_block();
1160-
processed_transaction alice_trx = blk.transactions[0];
1155+
generate_block();
11611156
alice_htlc_id_carl = alice_trx.operation_results[0].get<object_id_type>();
11621157
generate_block();
11631158
set_expiration( db, trx );
@@ -1177,11 +1172,10 @@ try {
11771172
create_operation.fee = db.get_global_properties().parameters.current_fees->calculate_fee(create_operation);
11781173
trx.operations.push_back(create_operation);
11791174
sign(trx, alice_private_key);
1180-
PUSH_TX(db, trx, ~0);
1175+
processed_transaction alice_trx = PUSH_TX(db, trx, ~0);
11811176
trx.clear();
11821177
set_expiration( db, trx );
1183-
graphene::chain::signed_block blk = generate_block();
1184-
processed_transaction alice_trx = blk.transactions[0];
1178+
generate_block();
11851179
alice_htlc_id_dan = alice_trx.operation_results[0].get<object_id_type>();
11861180
generate_block();
11871181
set_expiration( db, trx );

0 commit comments

Comments
 (0)