Skip to content

Commit

Permalink
fixed unique txs in block_query_test
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
  • Loading branch information
MBoldyrev committed Nov 7, 2019
1 parent d5436a0 commit ed2be80
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/module/irohad/ametsuchi/block_query_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "backend/protobuf/proto_block_json_converter.hpp"
#include "common/byteutils.hpp"
#include "converters/protobuf/json_proto_converter.hpp"
#include "datetime/time.hpp"
#include "framework/result_fixture.hpp"
#include "framework/test_logger.hpp"
#include "module/irohad/ametsuchi/ametsuchi_fixture.hpp"
Expand Down Expand Up @@ -48,12 +49,20 @@ class BlockQueryTest : public AmetsuchiTest {
empty_blocks = std::make_shared<PostgresBlockQuery>(
*sql, *mock_block_storage, getTestLogger("PostgresBlockQueryEmpty"));

auto make_tx = [created_time =
iroha::time::now()](const auto &creator) mutable {
return TestTransactionBuilder()
.creatorAccountId(creator)
.createdTime(created_time++)
.build();
};

// First transaction in block1
auto txn1_1 = TestTransactionBuilder().creatorAccountId(creator1).build();
auto txn1_1 = make_tx(creator1);
tx_hashes.push_back(txn1_1.hash());

// Second transaction in block1
auto txn1_2 = TestTransactionBuilder().creatorAccountId(creator1).build();
auto txn1_2 = make_tx(creator1);
tx_hashes.push_back(txn1_2.hash());

std::vector<shared_model::proto::Transaction> txs1;
Expand All @@ -70,11 +79,11 @@ class BlockQueryTest : public AmetsuchiTest {
.build();

// First tx in block 1
auto txn2_1 = TestTransactionBuilder().creatorAccountId(creator1).build();
auto txn2_1 = make_tx(creator1);
tx_hashes.push_back(txn2_1.hash());

// Second tx in block 2
auto txn2_2 = TestTransactionBuilder().creatorAccountId(creator2).build();
auto txn2_2 = make_tx(creator2);
tx_hashes.push_back(txn2_2.hash());

std::vector<shared_model::proto::Transaction> txs2;
Expand Down

0 comments on commit ed2be80

Please sign in to comment.