Skip to content

Commit

Permalink
fix: add pendingTx
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxu12 committed Aug 17, 2021
1 parent 6e7cc9d commit 4d6d3c7
Showing 1 changed file with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import express from "express";

import {
Containers,
//IrohaTestLedger,
pruneDockerAllIfGithubAction,
PostgresTestContainer,
IrohaTestLedger,
Expand All @@ -25,7 +24,6 @@ import {
import {
PluginLedgerConnectorIroha,
DefaultApi as IrohaApi,
//RunTransactionRequest,
PluginFactoryLedgerConnector,
RunTransactionRequest,
} from "../../../main/typescript/public-api";
Expand Down Expand Up @@ -126,7 +124,7 @@ test(testCase, async (t: Test) => {
const adminID = `${admin}@${domain}`;
const user = uuidv4().substring(0, 5);
/**
* Account is formatted as: `account_name@domain_id`
* An account in Iroha ledger is formatted as: `account_name@domain_id`
* @see https://iroha.readthedocs.io/en/main/concepts_architecture/er_model.html?highlight=%3Casset_name%3E%23%3Cdomain_id%3E#account
*/
const userID = `${user}@${domain}`;
Expand Down Expand Up @@ -199,7 +197,7 @@ test(testCase, async (t: Test) => {

const asset = "coolcoin";
/**
* Asset is formatted as: `asset_name#domain_id`
* An asset in Iroha ledger is formatted as: `asset_name#domain_id`
* @see https://iroha.readthedocs.io/en/main/concepts_architecture/er_model.html?highlight=%3Casset_name%3E%23%3Cdomain_id%3E#asset
*/
const assetID = `${asset}#${domain}`;
Expand Down Expand Up @@ -946,6 +944,33 @@ test(testCase, async (t: Test) => {
);
}

/**
* FIXME - the Iroha Javascript SDK does not give any output if we try to produce a pending transaction
* This results in an infinite loop and thus the following code cannot be executed.
* Once the Iroha Javascript SDK is justitied. We can safely produce a pending transaction.
* @see https://github.com/hyperledger/iroha-javascript/issues/66
* Dealing with it will cause the test suite fail, so only testing against an empty pending transaction case.
*/
{
const req = {
commandName: IrohaQuery.GetPendingTransactions,
baseConfig: {
irohaHost: irohaHost,
irohaPort: irohaPort,
creatorAccountId: adminID,
privKey: [adminPriv],
quorum: 1,
timeoutLimit: 5000,
},
params: [5, undefined],
};
const res = await apiClient.runTransactionV1(req as RunTransactionRequest);
t.ok(res);
t.ok(res.data);
t.equal(res.status, 200);
t.deepEqual(res.data.transactionReceipt, []);
}

const keyPair5: KeyPair = cryptoHelper.generateKeyPair();
const adminPubC = keyPair5.publicKey;
const adminPrivC = keyPair5.privateKey;
Expand Down Expand Up @@ -993,8 +1018,8 @@ test(testCase, async (t: Test) => {
const keyPair6: KeyPair = cryptoHelper.generateKeyPair();
const nodePubB = keyPair6.publicKey;
/**
* Fake the peer address with Postgres's address because
* it is different from existing Iroha node's address
* Take advantage of Postgres's address to fake it as the peer address
* since it is different from existing Iroha node's address
*/
const peerAddr = `${postgresHost}:${postgresPort}`;
{
Expand Down

0 comments on commit 4d6d3c7

Please sign in to comment.