Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async init() {
// TODO: How to judge Iroha service's status elegantly?
return CaliperUtils.sleep(10000); // Wait for Iroha network to start up
}
let spinner = ora('Joining peers to channels').start();
try {
await runCommand(fetchCmd);
const attempts = 5; // The join process can fail if couchDB is being used, so condition for that here
for (let i = 0; i
async installSmartContract() {
// With flow conditioning, this phase is conditionally required
if (!this.initPhaseCompleted ) {
await this._initializeRegistrars(true);
await this._initializeAdmins(true);
await this._initializeUsers(true);
}
await this._installChaincodes();
if (await this._instantiateChaincodes()) {
logger.info(`Sleeping ${this.configSleepAfterInstantiateChaincode / 1000.0}s...`);
await CaliperUtils.sleep(this.configSleepAfterInstantiateChaincode);
}
}
async init() {
let tlsInfo = this.networkUtil.isMutualTlsEnabled() ? 'mutual'
: (this.networkUtil.isTlsEnabled() ? 'server' : 'none');
let compMode = this.networkUtil.isInCompatibilityMode() ? '; Fabric v1.0 compatibility mode' : '';
logger.info(`Fabric SDK version: ${this.version.toString()}; TLS: ${tlsInfo}${compMode}`);
await this._initializeRegistrars(true);
await this._initializeAdmins(true);
await this._initializeUsers(true);
this.initPhaseCompleted = true;
if (await this._createChannels()) {
logger.info(`Sleeping ${this.configSleepAfterCreateChannel / 1000.0}s...`);
await CaliperUtils.sleep(this.configSleepAfterCreateChannel);
}
if (await this._joinChannels()) {
logger.info(`Sleeping ${this.configSleepAfterJoinChannel / 1000.0}s...`);
await CaliperUtils.sleep(this.configSleepAfterJoinChannel);
}
}
init() {
return CaliperUtils.sleep(2000);
}
}).catch(async (reason) => {
await CaliperUtils.sleep(2000);
updateCurrentBlockNumber(networkConfig);
});
}
let compMode = this.networkUtil.isInCompatibilityMode() ? '; Fabric v1.0 compatibility mode' : '';
logger.info(`Fabric SDK version: ${this.version.toString()}; TLS: ${tlsInfo}${compMode}`);
await this._initializeRegistrars(true);
await this._initializeAdmins(true);
await this._initializeUsers(true);
this.initPhaseCompleted = true;
if (await this._createChannels()) {
logger.info(`Sleeping ${this.configSleepAfterCreateChannel / 1000.0}s...`);
await CaliperUtils.sleep(this.configSleepAfterCreateChannel);
}
if (await this._joinChannels()) {
logger.info(`Sleeping ${this.configSleepAfterJoinChannel / 1000.0}s...`);
await CaliperUtils.sleep(this.configSleepAfterJoinChannel);
}
}
async function getBatchEventResponse(batchID, batchStats, timeout) {
try {
const beforeTime = Date.now();
while(batchCommitStatus.get(batchID) === 'pending') {
if((Date.now() - beforeTime) > timeout) {
throw new Error('Timeout, batchID: ' + batchID);
}
await CaliperUtils.sleep(200);
}
batchStats.SetStatusSuccess();
return batchStats;
} catch(err){
logger.info('getBatchEventResponse err: ' + err);
batchStats.SetStatusFail();
return batchStats;
}
}
.then(decoded => {
const status = _.findKey(ClientEventsUnsubscribeResponse.Status,
val => val === decoded.status);
if (status !== 'OK') {
throw new Error(`Validator responded with status "${status}"`);
}
stream1.close();
return CaliperUtils.sleep(1000);
});
}